% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\usepackage[margin=1in]{geometry}
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{#1}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{#1}}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{#1}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{#1}}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
\usepackage{xcolor}
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  pdftitle={Master File: All Stata and R Scripts},
  pdfauthor={Valentina Gonzalez Rostani},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\title{Master File: All Stata and R Scripts}
\author{Valentina Gonzalez Rostani}
\date{2024-08-24}

\begin{document}
\maketitle

{
\setcounter{tocdepth}{5}
\tableofcontents
}
\hypertarget{overvie-of-this-file}{%
\section{Overvie of this file}\label{overvie-of-this-file}}

This file contains most of the code and data needed to replicate results
in Gonzalez-Rostani (2024) ``Elections, Right-wing Populism, and
Political-Economic Polarization: The Role of Institutions and Political
Outsiders.'' The structure of the file is based on each one of the files
(scripts, do-files, rmd) that can be found in the folder \texttt{do}.
All of the replication instructions assume that you set the working
directory to the same folder as the \texttt{Master.rmd} or `Master.pdf``
files.

How this file is organized?

\begin{itemize}
\tightlist
\item
  Each section refers to a code file.
\item
  At the beginning the inputs, and outputs are explained.
\item
  Subsections are used to refer to the number/title of the Figure or
  Table generated.
\end{itemize}

\textbf{NOTE}: This code does not include files jupyter notebooks:

\begin{itemize}
\tightlist
\item
  2\_0\_Speech\_US\_dictionaries.ipynb
\item
  2\_3\_Speech\_US\_Germany\_Appendix\_NMF.ipynb
\end{itemize}

Refer to these files directly in the \texttt{do} folder.

If you prefer to see each file individually go to the folder
\texttt{do}.

\hypertarget{motivation-figures-4_1_figures_issp.do}{%
\section{Motivation Figures
{[}4\_1\_Figures\_ISSP.do{]}}\label{motivation-figures-4_1_figures_issp.do}}

This do-file:

\begin{itemize}
\tightlist
\item
  Creates Figure 1, 2 and A3 using data from ISSP.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data\textbackslash{}Figures\_ISSP.dta}
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  Figure 1: Relative Share of Labor Force 1995 to 2014
  {[}\texttt{Figures\textbackslash{}Relative\ Share\ of\ Labor\ Force\ 1998\ to\ 2014\ ISSP.pdf}{]}
\item
  Figure 2: Electoral consequences, Routine and Non-Routine Voters
  {[}\texttt{Figure/price\_by\_mpg.pdf}{]}
\item
  Figure A3: Importance of job security, Difficulties to find a new job,
  Concerns about losing the job and Job dissatisfaction
  {[}\texttt{Figure/jobdisatisfactionpredictedtogetherall.pdf}{]}
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Load  }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}Figures\_ISSP.dta"}\NormalTok{, }\KeywordTok{clear} 
    
\end{Highlighting}
\end{Shaded}

\hypertarget{figure-1-relative-share-of-labor-force-1995-to-2014}{%
\subsubsection{Figure 1: Relative Share of Labor Force 1995 to
2014}\label{figure-1-relative-share-of-labor-force-1995-to-2014}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*******************************************************************************}
\NormalTok{* Graphs}
\NormalTok{*******************************************************************************}
\NormalTok{* Graph style }\KeywordTok{for}\NormalTok{ F1 \& 2}
\NormalTok{\{}
\NormalTok{grstyle }\KeywordTok{clear}
\KeywordTok{set} \DecValTok{scheme}\NormalTok{ s2color}
\NormalTok{grstyle init}
\NormalTok{grstyle }\KeywordTok{set}\NormalTok{ plain, box}
\NormalTok{grstyle }\KeywordTok{color} \BaseNTok{background} \BaseNTok{white}
\NormalTok{grstyle }\KeywordTok{color}\NormalTok{ major\_grid gs8}
\NormalTok{grstyle linepattern major\_grid }\BaseNTok{dot}
\NormalTok{\}}
\CommentTok{// Figure 1: Relative Share of Labor Force 1995 to 2014}
\NormalTok{\{}
\NormalTok{    * Generating summary }\KeywordTok{statistics}\NormalTok{ with three task categories:}
\NormalTok{    * Task 1, Task 2, and Task 33 following Autor (2003) and coded }\KeywordTok{by}\NormalTok{ Kurer and Gallego (2019)}
    
\NormalTok{    * Preserve the current dataset }\KeywordTok{in} \DecValTok{memory}\NormalTok{ so it can }\KeywordTok{be}\NormalTok{ restored later}
    \KeywordTok{preserve} 
    
\NormalTok{    * Collapse the }\KeywordTok{data}\NormalTok{ to calculate the }\KeywordTok{mean} \KeywordTok{of}\NormalTok{ task1, task2, and task33 weighted }\KeywordTok{by}\NormalTok{ \textquotesingle{}weight\textquotesingle{} }\KeywordTok{for}\NormalTok{ each }\FunctionTok{year}
    \KeywordTok{collapse}\NormalTok{ task1 task2 task33 [aw=}\KeywordTok{weight}\NormalTok{], }\KeywordTok{by}\NormalTok{(}\FunctionTok{year}\NormalTok{)}
    
\NormalTok{    * Keep only the observations where the }\FunctionTok{year}\NormalTok{ is greater than 1997 to look }\KeywordTok{post}\NormalTok{ automation shock}
    \KeywordTok{keep} \KeywordTok{if} \FunctionTok{year}\NormalTok{ \textgreater{} 1997}
    
\NormalTok{    * Create a }\KeywordTok{line} \KeywordTok{graph} \KeywordTok{for}\NormalTok{ the task categories }\BaseNTok{over}\NormalTok{ time}
\NormalTok{    * The first }\KeywordTok{line}\NormalTok{ represents Non{-}Routine Cognitive tasks (}\KeywordTok{green} \KeywordTok{line}\NormalTok{)}
 \KeywordTok{graph} \KeywordTok{twoway} \KeywordTok{line}\NormalTok{  task1 }\FunctionTok{year} \KeywordTok{if} \FunctionTok{year}\NormalTok{\textgreater{}1997, lc(}\KeywordTok{green}\NormalTok{) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(1 }\StringTok{"Non{-}Routine Cognitive"}\NormalTok{)) || }\CommentTok{///}
  \KeywordTok{line}\NormalTok{  task2 }\FunctionTok{year} \KeywordTok{if} \FunctionTok{year}\NormalTok{\textgreater{}1997, lc(}\KeywordTok{red}\NormalTok{) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(2 }\StringTok{"Routine"}\NormalTok{)) || }\CommentTok{///}
    \KeywordTok{line}\NormalTok{  task33 }\FunctionTok{year} \KeywordTok{if} \FunctionTok{year}\NormalTok{\textgreater{}1997, lc(}\BaseNTok{blue}\NormalTok{) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(3 }\StringTok{"Non{-}Routine Manual"}\NormalTok{)) }

    
\NormalTok{    * Export the }\KeywordTok{graph} \KeywordTok{as}\NormalTok{ a PDF file with the specified }\BaseNTok{name}\NormalTok{, replacing any existing file}
    \KeywordTok{graph} \KeywordTok{export} \StringTok{"Figure\textbackslash{}RelativeShareofLaborForce1998to2014ISSP.pdf"}\NormalTok{, }\KeywordTok{as}\NormalTok{(pdf) }\KeywordTok{replace}
    
\NormalTok{    * Restore the original dataset that was }\KeywordTok{in} \DecValTok{memory}\NormalTok{ before the }\KeywordTok{collapse}
    \KeywordTok{restore}
\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(3 observations deleted)
file Figure\RelativeShareofLaborForce1998to2014ISSP.pdf saved as PDF format
\end{verbatim}

\begin{figure}
\centering
\includegraphics[width=12cm,height=\textheight]{Figure/RelativeShareofLaborForce1998to2014ISSP.pdf}
\caption{Figure 1: Relative Share of Labor Force 1995 to 2014}
\end{figure}

\hypertarget{figure-2-electoral-consequences-routine-and-non-routine-voters}{%
\subsubsection{Figure 2: Electoral consequences, Routine and Non-Routine
Voters}\label{figure-2-electoral-consequences-routine-and-non-routine-voters}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// Figure 2: Electoral consequences, Routine and Non{-}Routine Voters}
\NormalTok{\{}
\NormalTok{* Here }\FunctionTok{I}\NormalTok{ look }\FunctionTok{at}\NormalTok{ the share }\KeywordTok{of}\NormalTok{ votes }\KeywordTok{by}\NormalTok{ party }\KeywordTok{family}\NormalTok{, and instead }\KeywordTok{of} \KeywordTok{using}\NormalTok{ the three categories }\KeywordTok{of}\NormalTok{ risks, }\FunctionTok{I}\NormalTok{ put together non{-}routine manual and routine. }\FunctionTok{I} \KeywordTok{repeat} \KeywordTok{this} \KeywordTok{for}\NormalTok{ RR, ML, MR, Non{-}voters. Code commented }\KeywordTok{in}\NormalTok{ the first one. }
\CommentTok{// Radical right (graph commented)}
\NormalTok{\{}
\NormalTok{* Label the }\KeywordTok{variable}\NormalTok{ \textquotesingle{}radicalR\textquotesingle{} to represent }\StringTok{"Votes for Right Populist (\%)"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ radicalR }\StringTok{"Votes for Right Populist (\%)"}

\NormalTok{* Preserve the current dataset }\KeywordTok{in} \DecValTok{memory}\NormalTok{ so it can }\KeywordTok{be}\NormalTok{ restored later}
\KeywordTok{preserve}    

\NormalTok{* Generate a }\KeywordTok{new} \KeywordTok{variable}\NormalTok{ \textquotesingle{}task2and3\textquotesingle{} initialized to 1 }\KeywordTok{if}\NormalTok{ \textquotesingle{}task2\textquotesingle{} equals 1}
\KeywordTok{gen}\NormalTok{ task2and3 = 1 }\KeywordTok{if}\NormalTok{ task2 == 1}

\NormalTok{* Replace \textquotesingle{}task2and3\textquotesingle{} with 1 }\KeywordTok{if}\NormalTok{ \textquotesingle{}task33\textquotesingle{} equals 1 (combining task2 and task33)}
\KeywordTok{replace}\NormalTok{ task2and3 = 1 }\KeywordTok{if}\NormalTok{ task33 == 1}

\NormalTok{* Replace \textquotesingle{}task2and3\textquotesingle{} with 0 }\KeywordTok{if}\NormalTok{ \textquotesingle{}task1\textquotesingle{} equals 1 (Non{-}Routine Cognitive tasks)}
\KeywordTok{replace}\NormalTok{ task2and3 = 0 }\KeywordTok{if}\NormalTok{ task1 == 1}

\NormalTok{* Keep only observations where \textquotesingle{}emplB\textquotesingle{} is less than 6 (likely filtering }\KeywordTok{by}\NormalTok{ employment status }\KeywordTok{or}\NormalTok{ category)}
\KeywordTok{keep} \KeywordTok{if}\NormalTok{ emplB \textless{} 6}

\NormalTok{* Collapse the }\KeywordTok{data}\NormalTok{ to calculate the }\KeywordTok{mean} \KeywordTok{of}\NormalTok{ \textquotesingle{}radicalR\textquotesingle{} weighted }\KeywordTok{by}\NormalTok{ \textquotesingle{}weight\textquotesingle{} }\KeywordTok{for}\NormalTok{ each }\FunctionTok{year}\NormalTok{, task1, and task2and3 categories}
\KeywordTok{collapse}\NormalTok{ radicalR [aw=}\KeywordTok{weight}\NormalTok{], }\KeywordTok{by}\NormalTok{(}\FunctionTok{year}\NormalTok{ task1 task2and3)}

\NormalTok{* Create a }\KeywordTok{line} \KeywordTok{graph} \KeywordTok{for}\NormalTok{ \textquotesingle{}radicalR\textquotesingle{} }\BaseNTok{over}\NormalTok{ time, segmented }\KeywordTok{by}\NormalTok{ task categories}
\KeywordTok{graph} \KeywordTok{twoway} \KeywordTok{line}\NormalTok{  radicalR }\FunctionTok{year} \KeywordTok{if}\NormalTok{ task1==1, lc(}\KeywordTok{green}\NormalTok{) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(1 }\StringTok{"Non{-}Routine Cognitive"}\NormalTok{))  || }\CommentTok{///}
  \KeywordTok{line}\NormalTok{  radicalR }\FunctionTok{year} \KeywordTok{if}\NormalTok{ task2and3==1, lc(}\KeywordTok{red}\NormalTok{) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(2 }\StringTok{"Routine \& Manual"}\NormalTok{)) }\BaseNTok{ytitle}\NormalTok{(}\StringTok{"Votes for Right Populist (\%)"}\NormalTok{, }\KeywordTok{size}\NormalTok{(small))    }\BaseNTok{legend}\NormalTok{(}\KeywordTok{size}\NormalTok{(vsmall))  }\BaseNTok{xtitle}\NormalTok{(}\StringTok{"Year"}\NormalTok{, }\KeywordTok{size}\NormalTok{(small))   }\KeywordTok{ylabel}\NormalTok{(, }\BaseNTok{labsize}\NormalTok{(vsmall))  }\KeywordTok{xlabel}\NormalTok{(, }\BaseNTok{labsize}\NormalTok{(vsmall))}

\NormalTok{* Save the }\KeywordTok{graph} \KeywordTok{as} \StringTok{"RR.gph"} \KeywordTok{in}\NormalTok{ the }\StringTok{"Figure"}\NormalTok{ directory, replacing any existing file with the same }\BaseNTok{name}
\KeywordTok{graph} \KeywordTok{save} \StringTok{"Figure/RR.gph"}\NormalTok{, }\KeywordTok{replace}

\NormalTok{* Restore the original dataset that was }\KeywordTok{in} \DecValTok{memory}\NormalTok{ before the modifications}
\KeywordTok{restore}
\NormalTok{\}}
\CommentTok{// Maintream left}
\NormalTok{\{}
 \KeywordTok{preserve}   

\KeywordTok{gen}\NormalTok{ task2and3=1 }\KeywordTok{if}\NormalTok{ task2==1}
\KeywordTok{replace}\NormalTok{ task2and3=1 }\KeywordTok{if}\NormalTok{ task33==1}
\KeywordTok{replace}\NormalTok{ task2and3=0 }\KeywordTok{if}\NormalTok{ task1==1}

\KeywordTok{keep} \KeywordTok{if}\NormalTok{ emplB\textless{}6}
\KeywordTok{collapse}\NormalTok{ mainstreamleft [aw=}\KeywordTok{weight}\NormalTok{], }\KeywordTok{by}\NormalTok{(}\FunctionTok{year}\NormalTok{ task1 task2and3)}

\KeywordTok{graph} \KeywordTok{twoway} \KeywordTok{line}\NormalTok{  mainstreamleft }\FunctionTok{year} \KeywordTok{if}\NormalTok{ task1==1, lc(}\KeywordTok{green}\NormalTok{)   }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(1 }\StringTok{"Non{-}Routine Cognitive"}\NormalTok{))  || }\CommentTok{///}
  \KeywordTok{line}\NormalTok{  mainstreamleft }\FunctionTok{year} \KeywordTok{if}\NormalTok{ task2and3==1, lc(}\KeywordTok{red}\NormalTok{) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(2 }\StringTok{"Routine \& Manual"}\NormalTok{))  }\BaseNTok{ytitle}\NormalTok{(}\StringTok{"Votes for Mainstream Left (\%)"}\NormalTok{, }\KeywordTok{size}\NormalTok{(small))    }\BaseNTok{legend}\NormalTok{(}\KeywordTok{size}\NormalTok{(vsmall))  }\BaseNTok{xtitle}\NormalTok{(}\StringTok{"Year"}\NormalTok{, }\KeywordTok{size}\NormalTok{(small))   }\KeywordTok{ylabel}\NormalTok{(, }\BaseNTok{labsize}\NormalTok{(vsmall))  }\KeywordTok{xlabel}\NormalTok{(, }\BaseNTok{labsize}\NormalTok{(vsmall))}
\KeywordTok{graph} \KeywordTok{save} \StringTok{"Figure/ML.gph"}\NormalTok{, }\KeywordTok{replace}

\KeywordTok{restore} 
\NormalTok{\}}
\CommentTok{// Mainstream right}
\NormalTok{\{}
 \KeywordTok{preserve}   

\KeywordTok{gen}\NormalTok{ task2and3=1 }\KeywordTok{if}\NormalTok{ task2==1}
\KeywordTok{replace}\NormalTok{ task2and3=1 }\KeywordTok{if}\NormalTok{ task33==1}
\KeywordTok{replace}\NormalTok{ task2and3=0 }\KeywordTok{if}\NormalTok{ task1==1}

\KeywordTok{keep} \KeywordTok{if}\NormalTok{ emplB\textless{}6}
\KeywordTok{collapse}\NormalTok{ mainstreamright [aw=}\KeywordTok{weight}\NormalTok{], }\KeywordTok{by}\NormalTok{(}\FunctionTok{year}\NormalTok{ task1 task2and3)}

\KeywordTok{graph} \KeywordTok{twoway} \KeywordTok{line}\NormalTok{  mainstreamright }\FunctionTok{year} \KeywordTok{if}\NormalTok{ task1==1, lc(}\KeywordTok{green}\NormalTok{)  }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(1 }\StringTok{"Non{-}Routine Cognitive"}\NormalTok{))  || }\CommentTok{///}
  \KeywordTok{line}\NormalTok{  mainstreamright }\FunctionTok{year} \KeywordTok{if}\NormalTok{ task2and3==1, lc(}\KeywordTok{red}\NormalTok{) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(2 }\StringTok{"Routine \& Manual"}\NormalTok{))  }\BaseNTok{ytitle}\NormalTok{(}\StringTok{"Votes for Mainstream Right (\%)"}\NormalTok{, }\KeywordTok{size}\NormalTok{(small))    }\BaseNTok{legend}\NormalTok{(}\KeywordTok{size}\NormalTok{(vsmall))  }\BaseNTok{xtitle}\NormalTok{(}\StringTok{"Year"}\NormalTok{, }\KeywordTok{size}\NormalTok{(small))   }\KeywordTok{ylabel}\NormalTok{(, }\BaseNTok{labsize}\NormalTok{(vsmall))  }\KeywordTok{xlabel}\NormalTok{(, }\BaseNTok{labsize}\NormalTok{(vsmall))}
\KeywordTok{graph} \KeywordTok{save} \StringTok{"Figure/MR.gph"}\NormalTok{, }\KeywordTok{replace}

\KeywordTok{restore} 
\NormalTok{\}}
\CommentTok{// Non Voters}
\NormalTok{\{}
 \KeywordTok{preserve}   

\KeywordTok{gen}\NormalTok{ task2and3=1 }\KeywordTok{if}\NormalTok{ task2==1}
\KeywordTok{replace}\NormalTok{ task2and3=1 }\KeywordTok{if}\NormalTok{ task33==1}
\KeywordTok{replace}\NormalTok{ task2and3=0 }\KeywordTok{if}\NormalTok{ task1==1}

\KeywordTok{keep} \KeywordTok{if}\NormalTok{ emplB\textless{}6}
\KeywordTok{collapse}\NormalTok{ nonvoters [aw=}\KeywordTok{weight}\NormalTok{], }\KeywordTok{by}\NormalTok{(}\FunctionTok{year}\NormalTok{ task1 task2and3)}

\KeywordTok{graph} \KeywordTok{twoway} \KeywordTok{line}\NormalTok{  nonvoters }\FunctionTok{year} \KeywordTok{if}\NormalTok{ task1==1, lc(}\KeywordTok{green}\NormalTok{)  }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(1 }\StringTok{"Non{-}Routine Cognitive"}\NormalTok{))  || }\CommentTok{///}
  \KeywordTok{line}\NormalTok{  nonvoters }\FunctionTok{year} \KeywordTok{if}\NormalTok{ task2and3==1, lc(}\KeywordTok{red}\NormalTok{) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(2 }\StringTok{"Routine \& Manual"}\NormalTok{))   }\BaseNTok{ytitle}\NormalTok{(}\StringTok{"Non{-}Voters (\%)"}\NormalTok{, }\KeywordTok{size}\NormalTok{(small))    }\BaseNTok{legend}\NormalTok{(}\KeywordTok{size}\NormalTok{(vsmall))  }\BaseNTok{xtitle}\NormalTok{(}\StringTok{"Year"}\NormalTok{, }\KeywordTok{size}\NormalTok{(small))   }\KeywordTok{ylabel}\NormalTok{(, }\BaseNTok{labsize}\NormalTok{(vsmall))  }\KeywordTok{xlabel}\NormalTok{(, }\BaseNTok{labsize}\NormalTok{(vsmall))}
\KeywordTok{graph} \KeywordTok{save} \StringTok{"Figure/Nv.gph"}\NormalTok{, }\KeywordTok{replace}

\KeywordTok{restore} 
\NormalTok{\}}
\NormalTok{ * Combine multiple graphs into a single figure}
\KeywordTok{graph} \BaseNTok{combine} \StringTok{"Figure/ML.gph"} \StringTok{"Figure/MR.gph"} \StringTok{"Figure/RR.gph"} \StringTok{"Figure/Nv.gph"}
\NormalTok{* Export the combined }\KeywordTok{graph} \KeywordTok{as}\NormalTok{ a PDF file named }\StringTok{"price\_by\_mpg.pdf"} \KeywordTok{in}\NormalTok{ the }\StringTok{"Figure"}\NormalTok{ directory}
\KeywordTok{graph} \KeywordTok{export} \StringTok{"Figure/price\_by\_mpg.pdf"}\NormalTok{, }\KeywordTok{as}\NormalTok{(pdf) }\KeywordTok{replace}

\NormalTok{* Erase (}\KeywordTok{delete}\NormalTok{) the individual }\KeywordTok{graph}\NormalTok{ files from the }\StringTok{"Figure"}\NormalTok{ directory after combining them}
\NormalTok{erase }\StringTok{"Figure/ML.gph"}
\NormalTok{erase }\StringTok{"Figure/MR.gph"}
\NormalTok{erase }\StringTok{"Figure/RR.gph"}
\NormalTok{erase }\StringTok{"Figure/Nv.gph"}



\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(162,633 missing values generated)
(43,947 real changes made)
(71,529 real changes made)
(17,803 observations deleted)
(file Figure/RR.gph not found)
file Figure/RR.gph saved
(162,633 missing values generated)
(43,947 real changes made)
(71,529 real changes made)
(17,803 observations deleted)
(file Figure/ML.gph not found)
file Figure/ML.gph saved
(162,633 missing values generated)
(43,947 real changes made)
(71,529 real changes made)
(17,803 observations deleted)
(file Figure/MR.gph not found)
file Figure/MR.gph saved
(162,633 missing values generated)
(43,947 real changes made)
(71,529 real changes made)
(17,803 observations deleted)
(file Figure/Nv.gph not found)
file Figure/Nv.gph saved
file Figure/price_by_mpg.pdf saved as PDF format
\end{verbatim}

\begin{figure}
\centering
\includegraphics[width=12cm,height=\textheight]{Figure/price_by_mpg.pdf}
\caption{Figure 2: Electoral consequences, Routine and Non-Routine
Voters}
\end{figure}

\hypertarget{vote-switching-across-institutions}{%
\section{Vote-switching across
Institutions}\label{vote-switching-across-institutions}}

\hypertarget{us-1_1_switching_us.do}{%
\subsection{US
{[}1\_1\_Switching\_US.do{]}}\label{us-1_1_switching_us.do}}

\begin{itemize}
\tightlist
\item
  This do-file:

  \begin{itemize}
  \tightlist
  \item
    Processing of the data

    \begin{itemize}
    \tightlist
    \item
      Call the Data
    \item
      Define variables
    \item
      Save the data
    \end{itemize}
  \item
    Load preapred data \textbf{line 794}
  \item
    Analysis and Descriptives: Export Tables \& Figure
  \end{itemize}
\end{itemize}

Input: GSS data -
\texttt{Data\textbackslash{}Switching\textbackslash{}GSS7218\_R3.dta}

Final output:

\begin{itemize}
\tightlist
\item
  Cleaned data:

  \begin{itemize}
  \tightlist
  \item
    \texttt{Data\textbackslash{}GSS.dta} this data contains the relevant
    variables for the analysis.
  \end{itemize}
\item
  Tables:

  \begin{itemize}
  \tightlist
  \item
    table A3: Switching Vote, IV - RTI, US
    {[}\texttt{Table\textbackslash{}USlong\_2.tex}{]}
  \item
    table A5: Switching Vote (alternative definition), IV - RTI
    {[}\texttt{Table\textbackslash{}USStrict\_2.tex}{]}
  \item
    table A6: Switching Vote, IV - Routine (dummy), US
    {[}\texttt{Table\textbackslash{}USdummy\_2.tex}{]}
  \item
    table A1: Descriptive statistic: USA GSS 2016 vs 2012
    {[}\texttt{Table/summarystats\_US.tex}{]}
  \end{itemize}
\item
  Figure:

  \begin{itemize}
  \tightlist
  \item
    Figure 3: The effect of exposure to automation on vote-switching.
    {[}US Part{]} {[}\texttt{Figure\textbackslash{}US.gph}{]}
  \end{itemize}
\end{itemize}

First, you will find the code to prepare the data (hidden in the pdf).

Loading the data.

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Alternatively }\KeywordTok{load}\NormalTok{ prepared }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}GSS.dta"}\NormalTok{, }\KeywordTok{clear}   
\NormalTok{lab }\KeywordTok{var}\NormalTok{  switching2\_broad }\StringTok{"Switching broad"}  
\NormalTok{lab }\KeywordTok{var}\NormalTok{  switching\_estrict }\StringTok{"Switching strict"}           
\end{Highlighting}
\end{Shaded}

\hypertarget{figure-3-the-effect-of-exposure-to-automation-on-vote-switching.-us-part}{%
\subsubsection{Figure 3: The effect of exposure to automation on
vote-switching. {[}US
Part{]}}\label{figure-3-the-effect-of-exposure-to-automation-on-vote-switching.-us-part}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// Figure 3: The effect of exposure to automation on vote{-}switching. [US Part]      }
\NormalTok{\{       }
\CommentTok{// Graph style      }
\NormalTok{grstyle }\KeywordTok{clear}       
\KeywordTok{set} \DecValTok{scheme}\NormalTok{ s2color      }
\NormalTok{grstyle init        }
\NormalTok{grstyle }\KeywordTok{set}\NormalTok{ plain, }\BaseNTok{nogrid}       
\NormalTok{grstyle }\KeywordTok{color} \BaseNTok{background} \BaseNTok{white}      
        
        
\KeywordTok{logit}\NormalTok{  switching\_estrict  rti female age  foreign   rincome offshwalt2  relskillspec t2 t3 i.region  [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018  }
        
\NormalTok{margins, atmeans }\FunctionTok{at}\NormalTok{(rti=({-}1.52(0.1)2.24))       }
\NormalTok{\}    }
\end{Highlighting}
\end{Shaded}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{marginsplot , }\KeywordTok{recast}\NormalTok{(}\KeywordTok{line}\NormalTok{) recastci(rline) ci1opts(fintensity(50) lpattern(}\BaseNTok{dot}\NormalTok{)) xti(Risk }\KeywordTok{of}\NormalTok{ automation (RTI {-} Index)) yti(Predicted Probability }\KeywordTok{of}\NormalTok{ Switching (95\% CI)) ti(}\StringTok{"US"}\NormalTok{) }\KeywordTok{saving}\NormalTok{(}\StringTok{"Figure\textbackslash{}US.gph"}\NormalTok{, }\KeywordTok{replace}\NormalTok{)       }
\CommentTok{// Export the same plot to a PDF file}
\KeywordTok{graph} \KeywordTok{export} \StringTok{"Figure\textbackslash{}US.pdf"}\NormalTok{, }\KeywordTok{replace}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
Variables that uniquely identify margins: rti
file Figure\US.gph saved

file Figure\US.pdf saved as PDF format
\end{verbatim}

\begin{figure}
\centering
\includegraphics[width=12cm,height=\textheight]{Figure/US.pdf}
\caption{Figure 3: The effect of exposure to automation on
vote-switching - US part}
\end{figure}

\hypertarget{table-a3-switching-vote-iv---rti-us}{%
\subsubsection{Table A3: Switching Vote, IV - RTI,
US}\label{table-a3-switching-vote-iv---rti-us}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#     }
\NormalTok{* Analysis      }
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#     }
\CommentTok{// table A3: Switching Vote, IV {-} RTI, US       }

\NormalTok{eststo }\KeywordTok{clear}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad rti  female age   foreign educ i.rincome  [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}              
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad rti  female age   foreign educ i.rincome offshwalt2  i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}  
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad rti  female age   foreign educ i.rincome offshwalt2 relskillspec  i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}         
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad rti  female age   foreign educ i.rincome offshwalt2 relskillspec t2 t3 unemployed }\BaseNTok{black}\NormalTok{ nonrelig i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}      

\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote, IV {-} RTI \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:rtilong\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"} \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rti  female age   foreign educ offshwalt2 relskillspec t2 t3  unemployed }\BaseNTok{black}\NormalTok{ nonrelig) scalars( }\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2 p$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate( }\StringTok{"Income = *.rincome"}  \StringTok{"Regional controls = *.region"}\NormalTok{)}
        
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)

(est2 stored)

(est3 stored)

(est4 stored)


Switching Vote, IV - RTI \label {tab:rtilong}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                 +Demogr~c    +Offsho~g       +Skill          All   
--------------------------------------------------------------------
Switching broad                                                     
RTI                  0.243*       0.376**      0.371**      0.396** 
                   (0.125)      (0.146)      (0.146)      (0.171)   
Female              -0.453       -0.475       -0.448       -0.632** 
                   (0.292)      (0.292)      (0.293)      (0.299)   
Age                  0.040***     0.046***     0.046***     0.042***
                   (0.009)      (0.009)      (0.009)      (0.009)   
Foreign born        -1.982***    -1.898***    -1.873***    -1.925***
                   (0.564)      (0.581)      (0.578)      (0.657)   
Education           -0.047       -0.026       -0.025       -0.045   
                   (0.054)      (0.059)      (0.059)      (0.061)   
Offshorability                   -0.586**     -0.588**     -0.638*  
                                (0.295)      (0.295)      (0.341)   
Skill-Specific~y                               0.023        0.039   
                                             (0.031)      (0.035)   
Task-Tech                                                  -0.220   
                                                          (0.410)   
Task-Inter                                                  0.105   
                                                          (0.427)   
Unemployed                                                 -0.865   
                                                          (0.900)   
Black                                                      -3.767***
                                                          (1.070)   
Non-Believer                                               -2.021***
                                                          (0.510)   
Income                 Yes          Yes          Yes          Yes   
Regional contr~s        No          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations           704          704          704          704   
R$^2 p$              0.100        0.158        0.159        0.268   
AIC                583.652      565.677      567.117      509.700   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}USlong\_2.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote, IV {-} RTI, US \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:rtilong\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"} \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rti  female age   foreign educ offshwalt2 relskillspec t2 t3  unemployed }\BaseNTok{black}\NormalTok{ nonrelig) scalars( }\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2 p$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate( }\StringTok{"Income = *.rincome"}  \StringTok{"Regional controls = *.region"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\USlong_2.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A3}

% Include the table with custom numbering
\input{Table/USlong_2.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a5-switching-vote-alternative-definition-iv---rti}{%
\subsubsection{Table A5: Switching Vote (alternative definition), IV -
RTI}\label{table-a5-switching-vote-alternative-definition-iv---rti}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// table A5: Switching Vote (alternative definition), IV {-} RTI      }
\NormalTok{\{       }
\NormalTok{eststo }\KeywordTok{clear}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching\_estrict rti  female age   foreign educ i.rincome  i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}        
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching\_estrict rti  female age   foreign educ i.rincome offshwalt2  i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}     
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching\_estrict rti  female age   foreign educ i.rincome offshwalt2 relskillspec  i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}        
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching\_estrict rti  female age   foreign educ i.rincome offshwalt2 relskillspec t2 t3 unemployed }\BaseNTok{black}\NormalTok{ nonrelig i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}     

\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote (alternative definition), IV {-} RTI \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:rtilongstrict\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"} \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rti  female age   foreign educ offshwalt2 relskillspec t2 t3  unemployed }\BaseNTok{black}\NormalTok{ nonrelig) scalars( }\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2 p$"} \StringTok{"aic AIC"}\NormalTok{ )  indicate( }\StringTok{"Income = *.rincome"}  \StringTok{"Regional controls = *.region"}\NormalTok{)      }

        
        
\NormalTok{\}       }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)

Switching Vote (alternative definition), IV - RTI \label {tab:rtilongstrict}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                 +Demogr~c    +Offsho~g       +Skill          All   
--------------------------------------------------------------------
Switching strict                                                    
RTI                  0.339*       0.388*       0.419*       0.821***
                   (0.198)      (0.211)      (0.218)      (0.259)   
Female              -0.910**     -0.961**     -1.027***    -1.111** 
                   (0.375)      (0.381)      (0.394)      (0.486)   
Age                  0.038***     0.042***     0.042***     0.025   
                   (0.013)      (0.013)      (0.013)      (0.016)   
Foreign born        -2.445***    -2.377***    -2.421***    -2.132** 
                   (0.654)      (0.701)      (0.704)      (0.900)   
Education           -0.259***    -0.241***    -0.242***    -0.233***
                   (0.074)      (0.078)      (0.079)      (0.081)   
Offshorability                   -0.559       -0.568       -1.154** 
                                (0.396)      (0.397)      (0.578)   
Skill-Specific~y                              -0.037       -0.050   
                                             (0.038)      (0.045)   
Task-Tech                                                   0.007   
                                                          (0.642)   
Task-Inter                                                 -0.407   
                                                          (0.698)   
Unemployed                                                 -0.575   
                                                          (0.909)   
Black                                                      -5.275***
                                                          (1.404)   
Non-Believer                                               -2.122***
                                                          (0.590)   
Income                 Yes          Yes          Yes          Yes   
Regional contr~s       Yes          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations           236          236          236          236   
R$^2 p$              0.264        0.272        0.274        0.475   
AIC                283.080      282.530      283.818      228.620   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}USStrict\_2.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote (alternative definition), IV {-} RTI, US \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:rtilongstrict\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"} \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rti  female age   foreign educ offshwalt2 relskillspec t2 t3  unemployed }\BaseNTok{black}\NormalTok{ nonrelig) scalars( }\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2 p$"} \StringTok{"aic AIC"}\NormalTok{ )  indicate( }\StringTok{"Income = *.rincome"}  \StringTok{"Regional controls = *.region"}\NormalTok{)      }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\USStrict_2.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A5}

% Include the table with custom numbering
\input{Table/USStrict_2.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a6-switching-vote-iv---routine-dummy-us}{%
\subsubsection{Table A6: Switching Vote, IV - Routine (dummy),
US}\label{table-a6-switching-vote-iv---routine-dummy-us}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// table A6: Switching Vote, IV {-} Routine (dummy), US       }
\NormalTok{\{       }
\NormalTok{eststo }\KeywordTok{clear}
\CommentTok{// Routine Dummy}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad task3cog2and3  female age   foreign educ i.rincome  i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}       
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad task3cog2and3  female age   foreign educ i.rincome offshwalt2  i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad task3cog2and3  female age   foreign educ i.rincome offshwalt2 relskillspec i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}        
        
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad task3cog2and3  female age   foreign educ i.rincome offshwalt2 relskillspec t2 t3 unemployed }\BaseNTok{black}\NormalTok{ nonrelig i.region [pw=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}        

\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote, IV {-} Routine (dummy) \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:task3cog2and3\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"} \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(task3cog2and3  female age   foreign educ offshwalt2 relskillspec t2 t3  unemployed }\BaseNTok{black}\NormalTok{ nonrelig) scalars( }\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2 p$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate( }\StringTok{"Income = *.rincome"}  \StringTok{"Regional controls = *.region"}\NormalTok{)      }

        
        
\NormalTok{\}       }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)

Switching Vote, IV - Routine (dummy) \label {tab:task3cog2and3}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                 +Demogr~c    +Offsho~g       +Skill          All   
--------------------------------------------------------------------
Switching broad                                                     
Routine              0.950***     0.900***     0.865***     0.873***
                   (0.308)      (0.306)      (0.310)      (0.329)   
Female              -0.364       -0.373       -0.359       -0.577** 
                   (0.273)      (0.275)      (0.276)      (0.291)   
Age                  0.045***     0.046***     0.048***     0.042***
                   (0.009)      (0.008)      (0.009)      (0.009)   
Foreign born        -1.592***    -1.562***    -1.528***    -1.590***
                   (0.508)      (0.503)      (0.505)      (0.559)   
Education            0.021        0.022        0.020        0.013   
                   (0.055)      (0.055)      (0.055)      (0.058)   
Offshorability                   -0.305       -0.326       -0.516   
                                (0.261)      (0.269)      (0.335)   
Skill-Specific~y                               0.016        0.044   
                                             (0.033)      (0.036)   
Task-Tech                                                  -0.482   
                                                          (0.403)   
Task-Inter                                                 -0.299   
                                                          (0.396)   
Unemployed                                                 -1.111   
                                                          (0.956)   
Black                                                      -3.861***
                                                          (1.077)   
Non-Believer                                               -2.095***
                                                          (0.509)   
Income                 Yes          Yes          Yes          Yes   
Regional contr~s       Yes          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations           770          770          767          767   
R$^2 p$              0.150        0.153        0.155        0.264   
AIC                613.107      613.307      610.766      547.849   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}USdummy\_2.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote, IV {-} Routine (dummy), US \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:task3cog2and3\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"} \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(task3cog2and3  female age   foreign educ offshwalt2 relskillspec t2 t3  unemployed }\BaseNTok{black}\NormalTok{ nonrelig) scalars( }\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2 p$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate( }\StringTok{"Income = *.rincome"}  \StringTok{"Regional controls = *.region"}\NormalTok{)       }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\USdummy_2.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A6}

% Include the table with custom numbering
\input{Table/USdummy_2}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a1-descriptive-statistic-usa-gss-2016-vs-2012}{%
\subsubsection{Table A1: Descriptive statistic: USA GSS 2016 vs
2012}\label{table-a1-descriptive-statistic-usa-gss-2016-vs-2012}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#     }
\NormalTok{* Descriptive       }
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#     }

\CommentTok{// table A1: Descriptive statistic: USA GSS 2016 vs 2012        }

\NormalTok{eststo }\KeywordTok{clear}
\KeywordTok{qui}\NormalTok{ estpost }\KeywordTok{sum}\NormalTok{ switching2\_broad   rti age  female   foreign }\BaseNTok{black}\NormalTok{ unemployed nonrelig rincome  region  offshwalt2 relskillspec t2 t3  [}\FunctionTok{w}\NormalTok{=wtssnr] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{d}      

\NormalTok{ *esttab ,  }\CommentTok{/// ,  ,        }
\NormalTok{    cells(}\StringTok{"mean(label(Mean) fmt(2)) p50(label(Median) fmt(2)) sd(label(S.D.) fmt(2)) min(label(Min.) fmt(0)) max(label(Max) fmt(0)) count(label(Obs.) fmt(0))"}\NormalTok{) }\CommentTok{/// }
\NormalTok{    nonumber }\KeywordTok{label} \KeywordTok{replace} \KeywordTok{noobs}\NormalTok{ varlabels(switching2\_broad }\StringTok{"Vote Switching"}\NormalTok{ rti }\StringTok{"RTI"}\NormalTok{ age }\StringTok{"Age"}\NormalTok{ female }\StringTok{"Female"}\NormalTok{ foreign }\StringTok{"Foreign born"} \BaseNTok{black} \StringTok{"Black"}\NormalTok{ unemployed }\StringTok{"Unemployed"}\NormalTok{ nonrelig }\StringTok{"Non{-}Believer"}\NormalTok{ rincome }\StringTok{"Income Level"}\NormalTok{ offshwalt2 }\StringTok{"Offshorability"}\NormalTok{ relskillspec }\StringTok{"Skill{-}Specificity"}\NormalTok{ t2 }\StringTok{"Task{-}Tech"}\NormalTok{ t3 }\StringTok{"Task{-}Inte"}\NormalTok{) nomtitle }
 
\NormalTok{esttab }\KeywordTok{using}  \StringTok{"Table\textbackslash{}summarystats\_US.tex"}\NormalTok{,  }\CommentTok{/// ,  ,        }
\NormalTok{    cells(}\StringTok{"mean(label(Mean) fmt(2)) p50(label(Median) fmt(2)) sd(label(S.D.) fmt(2)) min(label(Min.) fmt(0)) max(label(Max) fmt(0)) count(label(Obs.) fmt(0))"}\NormalTok{) }\CommentTok{/// }
\NormalTok{    nonumber }\KeywordTok{label} \KeywordTok{replace} \KeywordTok{noobs}\NormalTok{ varlabels(switching2\_broad }\StringTok{"Vote Switching"}\NormalTok{ rti }\StringTok{"RTI"}\NormalTok{ age }\StringTok{"Age"}\NormalTok{ female }\StringTok{"Female"}\NormalTok{ foreign }\StringTok{"Foreign born"} \BaseNTok{black} \StringTok{"Black"}\NormalTok{ unemployed }\StringTok{"Unemployed"}\NormalTok{ nonrelig }\StringTok{"Non{-}Believer"}\NormalTok{ rincome }\StringTok{"Income Level"}\NormalTok{ offshwalt2 }\StringTok{"Offshorability"}\NormalTok{ relskillspec }\StringTok{"Skill{-}Specificity"}\NormalTok{ t2 }\StringTok{"Task{-}Tech"}\NormalTok{ t3 }\StringTok{"Task{-}Inte"}\NormalTok{) nomtitle   }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\summarystats_US.tex)
\end{verbatim}

\begin{verbatim}
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{1}{cccccc}}
\hline\hline
                    &        Mean&      Median&        S.D.&        Min.&         Max&        Obs.\\
\hline
Vote Switching      &        0.15&        0.00&        0.36&           0&           1&        1468\\
RTI                 &       -0.11&       -0.44&        0.98&          -2&           2&        2045\\
Age                 &       46.67&       45.00&       17.74&          18&          89&        2341\\
Female              &        0.54&        1.00&        0.50&           0&           1&        2348\\
Foreign born        &        0.14&        0.00&        0.34&           0&           1&        2347\\
Black               &        0.15&        0.00&        0.36&           0&           1&        2348\\
Unemployed          &        0.04&        0.00&        0.19&           0&           1&        2348\\
Non-Believer        &        0.24&        0.00&        0.43&           0&           1&        2348\\
Income Level        &       10.30&       12.00&        3.06&           1&          12&        1315\\
region of interview &        5.19&        5.00&        2.51&           1&           9&        2348\\
Offshorability      &        0.42&        0.00&        0.49&           0&           1&        2248\\
Skill-Specificity   &        4.12&        3.38&        3.32&           1&          25&        2243\\
Task-Tech           &        0.27&        0.00&        0.44&           0&           1&        2248\\
Task-Inte           &        0.38&        0.00&        0.49&           0&           1&        2248\\
\hline\hline
\end{tabular}
}
\end{verbatim}

\renewcommand{\thetable}{A1}

\begin{table}[htbp]
    \centering
    \resizebox{\textwidth}{!}{%
        \input{Table/summarystats_US.tex}
    }
    \caption{Descriptive statistic: USA GSS 2016 vs 2012}
\end{table}

\renewcommand{\thetable}{\arabic{table}}

\hypertarget{germany-1_2_switching_germany.do}{%
\subsection{Germany
{[}1\_2\_Switching\_Germany.do{]}}\label{germany-1_2_switching_germany.do}}

\begin{itemize}
\tightlist
\item
  This do-file:

  \begin{itemize}
  \tightlist
  \item
    Processing of the data

    \begin{itemize}
    \tightlist
    \item
      Call the Data
    \item
      Define variables
    \item
      Save the data
    \end{itemize}
  \item
    Load prepared data \textbf{line 869}
  \item
    Analysis and Descriptives: Export Tables \& Figure
  \end{itemize}
\item
  Input: GSS data

  \begin{itemize}
  \tightlist
  \item
    \texttt{Data\textbackslash{}Switching\textbackslash{}pgen.dta}
  \item
    \texttt{Figure/US.gph} this will be used to merge with
    \texttt{German.gph} (i.e you should run first
    \texttt{1\_1\_Switching\_US.do})
  \end{itemize}
\end{itemize}

Final output:

\begin{itemize}
\tightlist
\item
  Cleaned data:

  \begin{itemize}
  \tightlist
  \item
    \texttt{Data\textbackslash{}SOEP.dta} this data contains the
    relevant variables for the analysis.
  \end{itemize}
\item
  Tables:

  \begin{itemize}
  \tightlist
  \item
    table A4: Switching Vote (Only left) - Germany, IV - RTI
    {[}\texttt{Table\textbackslash{}SDU.tex}{]}
  \item
    table A7: Switching Vote From Establishment Left and Right to
    Populist Right, IV - RTI, German
    {[}\texttt{Table\textbackslash{}SOEPlong\_2.tex}{]}
  \item
    table A8: Switching Vote, IV - Routine (dummy), Germany
    {[}\texttt{Table\textbackslash{}SOEPdummy\_2.tex}{]}
  \item
    table A9: Switching Vote (Only from the Right), IV - RTI
    {[}\texttt{Table\textbackslash{}CDU.tex}{]}
  \end{itemize}
\item
  Figures:
\item
  Figure 3: The effect of exposure to automation on vote-switching.
  {[}German Part{]} {[}\texttt{Figure/Germany.gph}{]}
\item
  Figure 3: The effect of exposure to automation on vote-switching.
  {[}Merging gph US and German part{]}
  {[}\texttt{Figure/Graph\_US\_Germany.pdf}{]}
\end{itemize}

Loading the data.

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Alternatively }\KeywordTok{load}\NormalTok{ prepared }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}SOEP.dta"}\NormalTok{, }\KeywordTok{clear}  
    
\end{Highlighting}
\end{Shaded}

\hypertarget{figure-3-the-effect-of-exposure-to-automation-on-vote-switching.-german-part}{%
\subsubsection{Figure 3: The effect of exposure to automation on
vote-switching. {[}German
Part{]}}\label{figure-3-the-effect-of-exposure-to-automation-on-vote-switching.-german-part}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// Graph style  }
\NormalTok{grstyle }\KeywordTok{clear}   
\KeywordTok{set} \DecValTok{scheme}\NormalTok{ s2color  }
\NormalTok{grstyle init    }
\NormalTok{grstyle }\KeywordTok{set}\NormalTok{ plain, }\BaseNTok{nogrid}   
\NormalTok{grstyle }\KeywordTok{color} \BaseNTok{background} \BaseNTok{white}  
    
\CommentTok{// Figure 3: The effect of exposure to automation on vote{-}switching. [German part]  }
\CommentTok{// Margins  }

\KeywordTok{logit}\NormalTok{  switching2   rti  female age  foreign   income offshwalt2      [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018 }
    
\NormalTok{margins, atmeans }\FunctionTok{at}\NormalTok{(rti=({-}1.52(0.05)2.24))  }

     
\end{Highlighting}
\end{Shaded}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{     marginsplot , }\KeywordTok{recast}\NormalTok{(}\KeywordTok{line}\NormalTok{) recastci(rline) ci1opts(fintensity(50) lpattern(}\BaseNTok{dot}\NormalTok{)) xti(Risk }\KeywordTok{of}\NormalTok{ automation (RTI {-} Index)) yti(Predicted Probability }\KeywordTok{of}\NormalTok{ Switching (95\% CI)) ti(}\StringTok{"Germany"}\NormalTok{)  }\KeywordTok{saving}\NormalTok{(}\StringTok{"Figure/Germany.gph"}\NormalTok{, }\KeywordTok{replace}\NormalTok{)   }

    
 \KeywordTok{graph} \BaseNTok{combine} \StringTok{"Figure/US.gph"} \StringTok{"Figure/Germany.gph"} 
 \KeywordTok{graph} \KeywordTok{export} \StringTok{"Figure/Graph\_US\_Germany.pdf"}\NormalTok{, }\KeywordTok{as}\NormalTok{(pdf) }\KeywordTok{replace}    
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
Variables that uniquely identify margins: rti
file Figure/Germany.gph saved


file Figure/Graph_US_Germany.pdf saved as PDF format
\end{verbatim}

\begin{figure}
\centering
\includegraphics[width=12cm,height=\textheight]{Figure/Graph_US_Germany.pdf}
\caption{Figure 3: The effect of exposure to automation on
vote-switching}
\end{figure}

\hypertarget{table-a4-switching-vote-only-left---germany-iv---rti}{%
\subsubsection{Table A4: Switching Vote (Only left) - Germany, IV -
RTI}\label{table-a4-switching-vote-only-left---germany-iv---rti}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#     }
\NormalTok{* Analysis      }
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#     }
\CommentTok{// table A4: Switching Vote (Only left) {-} Germany, IV {-} RTI }
\NormalTok{\{   }
\NormalTok{eststo }\KeywordTok{clear}                    
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2 rti  female age   foreign high i.rincome   [pw=phrf]   }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}               
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2 rti  female age   foreign high i.rincome offshwalt2  i.sampreg [pw=phrf]   }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}               
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2 rti  female age   foreign high i.rincome offshwalt2 relskillspec  i.sampreg  [pw=phrf]     }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018   , }\KeywordTok{robust}            
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2 rti  female age   foreign high i.rincome offshwalt2 relskillspec t2 t3 i.sampreg  [pw=phrf]    }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018   , }\KeywordTok{robust}            

\NormalTok{esttab, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote (Only left), IV {-} RTI \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:left\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"}  \StringTok{"All"}\NormalTok{)  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rti  female age    high offshwalt2 relskillspec t2 t3) scalars( }\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )indicate( }\StringTok{"Income = *income"}  \StringTok{"Regional controls = *.sampreg"}\NormalTok{)                  }

\NormalTok{\}   }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)

Switching Vote (Only left), IV - RTI \label {tab:left}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                 +Demogr~c    +Offsho~g       +Skill          All   
--------------------------------------------------------------------
Left to Pop Ri~t                                                    
RTI Index            0.210        0.902***     0.981***     0.887***
                   (0.197)      (0.323)      (0.317)      (0.248)   
Female              -0.427       -0.501       -0.301       -0.168   
                   (0.949)      (0.887)      (0.876)      (0.837)   
Age                 -0.029       -0.037       -0.047       -0.046   
                   (0.037)      (0.033)      (0.031)      (0.030)   
High-Skilled        -1.402       -1.464       -1.470       -1.447   
                   (1.030)      (1.462)      (1.359)      (1.265)   
Offshorability                   -2.773**     -3.049***    -3.131***
                                (1.201)      (0.948)      (1.004)   
Skill-Specific~y                               0.138**      0.129** 
                                             (0.055)      (0.058)   
Task-Tech                                                   0.108   
                                                          (0.959)   
Task-Inter                                                 -0.664   
                                                          (1.195)   
Income                 Yes          Yes          Yes          Yes   
Regional contr~s        No          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations          1070         1070         1070         1066   
R$^2$                0.067        0.182        0.202        0.210   
AIC                4.5e+05      4.0e+05      3.9e+05      3.8e+05   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}SDU.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote (Only left), IV {-} RTI, Germany  \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:left\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"}  \StringTok{"All"}\NormalTok{)  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rti  female age    high offshwalt2 relskillspec t2 t3) scalars( }\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )indicate( }\StringTok{"Income = *income"}  \StringTok{"Regional controls = *.sampreg"}\NormalTok{)                  }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\SDU.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A4}

% Include the table with custom numbering
\input{Table/SDU.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a7-switching-vote-from-establishment-left-and-right-to-populist-right-iv---rti-german}{%
\subsubsection{Table A7: Switching Vote From Establishment Left and
Right to Populist Right, IV - RTI,
German}\label{table-a7-switching-vote-from-establishment-left-and-right-to-populist-right-iv---rti-german}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// table A7: Switching Vote From Establishment Left and Right to Populist Right, IV {-} RTI, German   }
\NormalTok{\{   }
\NormalTok{eststo }\KeywordTok{clear}                    
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad rti  female age   foreign high i.rincome    [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018  , }\KeywordTok{robust}                
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad rti  female age   foreign high i.rincome offshwalt2  i.sampreg [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018   , }\KeywordTok{robust}                
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad rti  female age   foreign high i.rincome offshwalt2 relskillspec  i.sampreg [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018      , }\KeywordTok{robust}            
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad rti  female age   foreign high i.rincome offshwalt2 relskillspec t2 t3 i.sampreg [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018     , }\KeywordTok{robust}            

\NormalTok{esttab, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote From Establishment Left and Right to Populist Right, IV {-} RTI, Germany \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:Table1rtilongswnarrow2\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"}  \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rti  female age   foreign high offshwalt2 relskillspec t2 t3) scalars(}\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{) indicate( }\StringTok{"Income = *income"}  \StringTok{"Regional controls = *.sampreg"}\NormalTok{)                  }
    
\NormalTok{\}   }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)

Switching Vote From Establishment Left and Right to Populist Right, IV - RTI, G
> ermany \label {tab:Table1rtilongswnarrow2}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                 +Demogr~c    +Offsho~g       +Skill          All   
--------------------------------------------------------------------
Switching Vote                                                      
RTI Index            0.124        0.209*       0.207*       0.269*  
                   (0.098)      (0.125)      (0.120)      (0.140)   
Female              -1.260***    -1.212***    -1.272***    -1.365***
                   (0.227)      (0.226)      (0.237)      (0.257)   
Age                  0.003       -0.000        0.001        0.001   
                   (0.008)      (0.009)      (0.009)      (0.008)   
Foreign born        -1.125**     -0.966*      -0.948*      -0.973*  
                   (0.545)      (0.548)      (0.548)      (0.543)   
High-Skilled        -0.715**     -0.695**     -0.727**     -0.734** 
                   (0.328)      (0.327)      (0.325)      (0.317)   
Offshorability                   -0.331       -0.278       -0.072   
                                (0.270)      (0.277)      (0.322)   
Skill-Specific~y                              -0.050       -0.056   
                                             (0.035)      (0.038)   
Task-Tech                                                   0.176   
                                                          (0.347)   
Task-Inter                                                  0.603   
                                                          (0.412)   
Income                 Yes          Yes          Yes          Yes   
Regional contr~s        No          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations          7522         7522         7522         7510   
R$^2$                0.068        0.081        0.084        0.087   
AIC                5.7e+06      5.6e+06      5.6e+06      5.6e+06   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}SOEPlong\_2.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote From Establishment Left and Right to Populist Right, IV {-} RTI, Germany \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:Table1rtilongswnarrow2\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"}  \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rti  female age   foreign high offshwalt2 relskillspec t2 t3) scalars(}\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{) indicate( }\StringTok{"Income = *income"}  \StringTok{"Regional controls = *.sampreg"}\NormalTok{)                 }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\SOEPlong_2.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A7}

% Include the table with custom numbering
\input{Table/SOEPlong_2.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a8-switching-vote-iv---routine-dummy-germany}{%
\subsubsection{Table A8: Switching Vote, IV - Routine (dummy),
Germany}\label{table-a8-switching-vote-iv---routine-dummy-germany}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// table A6: Switching Vote, IV {-} Routine (dummy), US       }
\NormalTok{\{       }
\NormalTok{eststo }\KeywordTok{clear}                
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad task3cog2and3  female age   foreign high i.rincome   [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}                 
                    
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad task3cog2and3  female age   foreign high i.rincome offshwalt2  i.sampreg [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018     , }\KeywordTok{robust}            
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad task3cog2and3  female age   foreign high i.rincome offshwalt2 relskillspec i.sampreg [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018     , }\KeywordTok{robust}            
                    
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_broad task3cog2and3  female age   foreign high i.rincome offshwalt2 relskillspec t2 t3 i.sampreg [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018       , }\KeywordTok{robust}            

\NormalTok{esttab  , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote, IV {-} Routine (dummy), Germany \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:Table1rtilongswnarrowtask3cog2and3\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"}  \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(task3cog2and3  female age   foreign high offshwalt2 relskillspec t2 t3) scalars(}\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{) indicate( }\StringTok{"Income = *.rincome"}  \StringTok{"Regional controls = *.sampreg"}\NormalTok{)                }


        
        
\NormalTok{\}       }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)

Switching Vote, IV - Routine (dummy), Germany \label {tab:Table1rtilongswnarrow
> task3cog2and3}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                 +Demogr~c    +Offsho~g       +Skill          All   
--------------------------------------------------------------------
Switching Vote                                                      
Routine              0.472*       0.463*       0.525**      0.576** 
                   (0.241)      (0.240)      (0.241)      (0.234)   
Female              -1.122***    -1.086***    -1.145***    -1.258***
                   (0.236)      (0.235)      (0.244)      (0.260)   
Age                  0.002        0.001        0.001        0.001   
                   (0.008)      (0.008)      (0.008)      (0.008)   
Foreign born        -0.817       -0.664       -0.652       -0.668   
                   (0.504)      (0.504)      (0.504)      (0.499)   
High-Skilled        -0.712**     -0.724**     -0.752**     -0.784** 
                   (0.310)      (0.313)      (0.312)      (0.305)   
Offshorability                   -0.083       -0.008        0.153   
                                (0.217)      (0.227)      (0.322)   
Skill-Specific~y                              -0.055       -0.047   
                                             (0.033)      (0.034)   
Task-Tech                                                  -0.086   
                                                          (0.303)   
Task-Inter                                                  0.334   
                                                          (0.383)   
Income                 Yes          Yes          Yes          Yes   
Regional contr~s        No          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations          8386         8386         8346         8334   
R$^2$                0.067        0.077        0.080        0.082   
AIC                6.1e+06      6.1e+06      6.0e+06      6.0e+06   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{    esttab  }\KeywordTok{using} \StringTok{"Table\textbackslash{}SOEPdummy\_2.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Switching Vote, IV {-} Routine (dummy), Germany \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:Table1rtilongswnarrowtask3cog2and3\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"}  \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(task3cog2and3  female age   foreign high offshwalt2 relskillspec t2 t3) scalars(}\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{) indicate( }\StringTok{"Income = *.rincome"}  \StringTok{"Regional controls = *.sampreg"}\NormalTok{)               }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\SOEPdummy_2.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A8}

% Include the table with custom numbering
\input{Table/SOEPdummy_2.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a9-switching-vote-only-from-the-right-iv---rti}{%
\subsubsection{Table A9: Switching Vote (Only from the Right), IV -
RTI}\label{table-a9-switching-vote-only-from-the-right-iv---rti}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// table A9: Switching Vote (Only from the Right), IV {-} RTI }
\NormalTok{eststo }\KeywordTok{clear}                
\NormalTok{    eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_r rti  female age   foreign high  i.rincome offshwalt2  i.sampreg [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}                              
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_r rti  female age   foreign high  i.rincome offshwalt2  i.sampreg [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018, }\KeywordTok{robust}  
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_r rti  female age   foreign high  i.rincome offshwalt2 relskillspec  i.sampreg [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018 , }\KeywordTok{robust}        
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{logit}\NormalTok{ switching2\_r rti  female age   foreign high  i.rincome offshwalt2 relskillspec t2 t3 i.sampreg [pw=phrf] }\KeywordTok{if} \FunctionTok{year}\NormalTok{==2018    , }\KeywordTok{robust}                
        
\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(PSwitching Vote (Only from the Right), IV {-} RTI \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:CDU\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"}  \StringTok{"All"}\NormalTok{)  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rti  female age   foreign high offshwalt2 relskillspec t2 t3) scalars( }\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )indicate( }\StringTok{"Income = *income"}  \StringTok{"Regional controls = *.sampreg"}\NormalTok{)                    }
        

    
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)

(est2 stored)

(est3 stored)

(est4 stored)


PSwitching Vote (Only from the Right), IV - RTI \label {tab:CDU}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                 +Demogr~c    +Offsho~g       +Skill          All   
--------------------------------------------------------------------
Right to AfD                                                        
RTI Index           -0.251       -0.251       -0.244       -0.113   
                   (0.335)      (0.335)      (0.307)      (0.324)   
Female              -1.781***    -1.781***    -1.854***    -2.097***
                   (0.650)      (0.650)      (0.654)      (0.688)   
Age                 -0.001       -0.001       -0.000        0.002   
                   (0.029)      (0.029)      (0.029)      (0.030)   
Foreign born         0.797        0.797        0.671        0.522   
                   (1.051)      (1.051)      (1.072)      (1.093)   
High-Skilled        -0.406       -0.406       -0.461       -0.713   
                   (0.806)      (0.806)      (0.806)      (0.560)   
Offshorability       1.140*       1.140*       1.241*       2.050** 
                   (0.668)      (0.668)      (0.691)      (1.008)   
Skill-Specific~y                              -0.113       -0.074   
                                             (0.094)      (0.095)   
Task-Tech                                                  -0.217   
                                                          (1.092)   
Task-Inter                                                  1.517   
                                                          (1.203)   
Income                 Yes          Yes          Yes          Yes   
Regional contr~s       Yes          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations          1484         1484         1484         1478   
R$^2$                0.171        0.171        0.179        0.208   
AIC                7.3e+05      7.3e+05      7.3e+05      7.0e+05   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}CDU.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(PSwitching Vote (Only from the Right), IV {-} RTI, Germany \textbackslash{}}\KeywordTok{label}\NormalTok{ \{}\KeywordTok{tab}\NormalTok{:CDU\})mti(}\StringTok{"+Demographic"} \StringTok{"+Offshoring"} \StringTok{"+Skill"}  \StringTok{"All"}\NormalTok{)  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rti  female age   foreign high offshwalt2 relskillspec t2 t3) scalars( }\StringTok{"N Observations"} \StringTok{"r2\_p R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )indicate( }\StringTok{"Income = *income"}  \StringTok{"Regional controls = *.sampreg"}\NormalTok{)                  }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\CDU.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A9}

% Include the table with custom numbering
\input{Table/CDU.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a2-descriptive-statistic-germany-soep-2014-vs-2018.}{%
\subsubsection{Table A2: Descriptive statistic: Germany SOEP 2014 vs
2018.}\label{table-a2-descriptive-statistic-germany-soep-2014-vs-2018.}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#     }
\NormalTok{* Descriptive       }
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#     }

\CommentTok{// table A2: Descriptive statistic: Germany SOEP 2014 vs 2018.  }

\NormalTok{eststo }\KeywordTok{clear}
\KeywordTok{qui}\NormalTok{ estpost }\KeywordTok{sum}\NormalTok{  switching2\_broad   rti age income female  foreign unemployed high  offshwalt2 relskillspec t2 t3 sampreg [}\FunctionTok{w}\NormalTok{=phrf] }\KeywordTok{if}\NormalTok{ switching2\_broad\textasciitilde{}=., }\KeywordTok{d}    
    
    
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}summarystats\_Germany.tex"}\NormalTok{ ,  }\CommentTok{/// ,  ,   }
\NormalTok{    cells(}\StringTok{"mean(label(Mean) fmt(2)) p50(label(Median) fmt(2)) sd(label(S.D.) fmt(2)) min(label(Min.) fmt(0)) max(label(Max) fmt(0)) count(label(Obs.) fmt(0))"}\NormalTok{) }\CommentTok{///}
\NormalTok{    nonumber }\KeywordTok{label} \KeywordTok{replace} \KeywordTok{noobs}\NormalTok{ varlabels(distance\_redist }\StringTok{"Distance Redistribution"}\NormalTok{ distance\_div }\StringTok{"Distance Diversity"}\NormalTok{ distance\_fixed }\StringTok{"Distance Fixed Attributes"}\NormalTok{ PRITM }\StringTok{"PR with Trichotomous Multipartism"}\NormalTok{ totseats }\StringTok{"Total Number of Seats"}\NormalTok{ number2 }\StringTok{"Total Number of Parties"}\NormalTok{ oecdmember }\StringTok{"OECD member"}\NormalTok{) nomtitle }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\summarystats_Germany.tex)
\end{verbatim}

\begin{verbatim}
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{1}{cccccc}}
\hline\hline
                    &        Mean&      Median&        S.D.&        Min.&         Max&        Obs.\\
\hline
Switching Vote      &        0.03&        0.00&        0.16&           0&           1&       29235\\
RTI Index           &       -0.12&       -0.44&        0.93&          -2&           2&       10185\\
Age                 &       50.75&       51.00&       18.91&          17&         103&       29235\\
income              &     2715.32&     2500.00&     1879.23&          20&       40000&       13712\\
Female              &        0.51&        1.00&        0.50&           0&           1&       29235\\
Foreign born        &        0.12&        0.00&        0.33&           0&           1&       29235\\
Unemployed          &        0.04&        0.00&        0.20&           0&           1&       29207\\
High-Skilled        &        0.32&        0.00&        0.47&           0&           1&       29235\\
Offshorability      &        0.46&        0.00&        0.50&           0&           1&       11383\\
Skill-Specificity   &        4.23&        3.58&        3.26&           1&          25&       11333\\
Task-Tech           &        0.34&        0.00&        0.47&           0&           1&       11319\\
Task-Inter          &        0.37&        0.00&        0.48&           0&           1&       11319\\
Region (West 1 - East 2)&        1.17&        1.00&        0.38&           1&           2&       29235\\
\hline\hline
\end{tabular}
}
\end{verbatim}

\renewcommand{\thetable}{A2}

\begin{table}[htbp]
    \centering
    \resizebox{\textwidth}{!}{%
        \input{Table/summarystats_Germany.tex}
    }
    \caption{Descriptive statistic: USA GSS 2016 vs 2012}
\end{table}

\renewcommand{\thetable}{\arabic{table}}

\hypertarget{additional-context-of-switching-in-germany-1_3_switching_appendix_spoonkluver.do}{%
\subsection{Additional Context of Switching in Germany
{[}1\_3\_Switching\_Appendix\_SpoonKluver.do{]}}\label{additional-context-of-switching-in-germany-1_3_switching_appendix_spoonkluver.do}}

This do-file:

\begin{itemize}
\tightlist
\item
  Creates Table A11 using data from the ESS.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data\textbackslash{}Appendix\_ESS.dta}
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  Table A11: Switching in Western European Countries from Mainstream
  Left to Outsider Radical Right parties 2002-2018
  {[}\texttt{Table\textbackslash{}ESS\_switching.tex}{]}
\end{itemize}

\hypertarget{table-a10-switching-in-germany-from-mainstream-to-non-mainstream-parties-2002-2009}{%
\subsubsection{Table A10: Switching in Germany from mainstream to
non-mainstream parties
2002-2009}\label{table-a10-switching-in-germany-from-mainstream-to-non-mainstream-parties-2002-2009}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Load }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}SpoonKluever\_2019\_EJPR\_PartyConvergence.dta"}\NormalTok{, }\KeywordTok{clear} 


\NormalTok{*******************************************************************************}
\NormalTok{* Preparing variables}
\NormalTok{*******************************************************************************}

\NormalTok{* Election years}
\KeywordTok{gen} \FunctionTok{year}\NormalTok{ = 2002 }\KeywordTok{in}\NormalTok{ 1}
\KeywordTok{replace} \FunctionTok{year}\NormalTok{ = 2005 }\KeywordTok{in}\NormalTok{ 2}
\KeywordTok{replace} \FunctionTok{year}\NormalTok{ = 2009 }\KeywordTok{in}\NormalTok{ 3}
\KeywordTok{replace} \FunctionTok{year}\NormalTok{ = 2013 }\KeywordTok{in}\NormalTok{ 4}

\NormalTok{* Initialize variables}
\KeywordTok{gen}\NormalTok{ SPD = .}
\KeywordTok{gen}\NormalTok{ Liberal = .}
\KeywordTok{gen}\NormalTok{ CDU = .}
\KeywordTok{gen}\NormalTok{ Total\_Switching = .}

\NormalTok{* Election dates and party codes}
\KeywordTok{local}\NormalTok{ dates }\StringTok{"22sep2002 18sep2005 27sep2009 22sep2013"}
\KeywordTok{local}\NormalTok{ SPD 41320}
\KeywordTok{local}\NormalTok{ Liberal 41420}
\KeywordTok{local}\NormalTok{ CDU 41521}

\NormalTok{* Loop }\BaseNTok{over}\NormalTok{ each }\FunctionTok{date}
\KeywordTok{local}\NormalTok{ i = 1}
\KeywordTok{foreach} \FunctionTok{date} \KeywordTok{of} \KeywordTok{local}\NormalTok{ dates \{}
\NormalTok{    * Total Switching }\KeywordTok{for}\NormalTok{ the }\FunctionTok{date}
    \KeywordTok{quietly} \KeywordTok{summarize}\NormalTok{ switch\_main }\KeywordTok{if}\NormalTok{ country == 41 \& edate == }\FunctionTok{date}\NormalTok{(}\StringTok{"\textasciigrave{}date\textquotesingle{}"}\NormalTok{, }\StringTok{"DMY"}\NormalTok{)}
    \KeywordTok{replace}\NormalTok{ Total\_Switching = }\FunctionTok{r}\NormalTok{(}\KeywordTok{mean}\NormalTok{) * 100 }\KeywordTok{in} \OtherTok{\textasciigrave{}i\textquotesingle{}}

\NormalTok{    * SPD}
    \KeywordTok{quietly} \KeywordTok{summarize}\NormalTok{ switch\_main }\KeywordTok{if}\NormalTok{ country == 41 \& edate == }\FunctionTok{date}\NormalTok{(}\StringTok{"\textasciigrave{}date\textquotesingle{}"}\NormalTok{, }\StringTok{"DMY"}\NormalTok{) \& party\_last == }\OtherTok{\textasciigrave{}SPD\textquotesingle{}}
    \KeywordTok{replace}\NormalTok{ SPD = }\FunctionTok{r}\NormalTok{(}\KeywordTok{mean}\NormalTok{) * 100 }\KeywordTok{in} \OtherTok{\textasciigrave{}i\textquotesingle{}}

\NormalTok{    * Liberal}
    \KeywordTok{quietly} \KeywordTok{summarize}\NormalTok{ switch\_main }\KeywordTok{if}\NormalTok{ country == 41 \& edate == }\FunctionTok{date}\NormalTok{(}\StringTok{"\textasciigrave{}date\textquotesingle{}"}\NormalTok{, }\StringTok{"DMY"}\NormalTok{) \& party\_last == }\OtherTok{\textasciigrave{}Liberal\textquotesingle{}}
    \KeywordTok{replace}\NormalTok{ Liberal = }\FunctionTok{r}\NormalTok{(}\KeywordTok{mean}\NormalTok{) * 100 }\KeywordTok{in} \OtherTok{\textasciigrave{}i\textquotesingle{}}

\NormalTok{    * CDU}
    \KeywordTok{quietly} \KeywordTok{summarize}\NormalTok{ switch\_main }\KeywordTok{if}\NormalTok{ country == 41 \& edate == }\FunctionTok{date}\NormalTok{(}\StringTok{"\textasciigrave{}date\textquotesingle{}"}\NormalTok{, }\StringTok{"DMY"}\NormalTok{) \& party\_last == }\OtherTok{\textasciigrave{}CDU\textquotesingle{}}
    \KeywordTok{replace}\NormalTok{ CDU = }\FunctionTok{r}\NormalTok{(}\KeywordTok{mean}\NormalTok{) * 100 }\KeywordTok{in} \OtherTok{\textasciigrave{}i\textquotesingle{}}

    \KeywordTok{local}\NormalTok{ i = }\OtherTok{\textasciigrave{}i\textquotesingle{}}\NormalTok{ + 1}
\NormalTok{\}}

\NormalTok{* Format the variables to }\KeywordTok{display}\NormalTok{ one decimal place}
\KeywordTok{format}\NormalTok{ SPD Liberal CDU Total\_Switching \%4.1f}

\CommentTok{// table A10: Switching in Germany from mainstream to non{-}mainstream parties 2002{-}2009}

\NormalTok{* Use tabdisp to }\KeywordTok{display}\NormalTok{ the results }\KeywordTok{in}\NormalTok{ a tabular }\KeywordTok{format}
\NormalTok{tabdisp }\FunctionTok{year}\NormalTok{, c(SPD Liberal CDU Total\_Switching)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(Spoon/Klüver (2019) EJPR: Party covergence and vote switching)

(14,633 missing values generated)

(1 real change made)

(1 real change made)

(1 real change made)

(14,634 missing values generated)

(14,634 missing values generated)

(14,634 missing values generated)

(14,634 missing values generated)






  3.     replace Total_Switching = r(mean) * 100 in `i'
  4. 
  5.     replace SPD = r(mean) * 100 in `i'
  6. 
  7.     replace Liberal = r(mean) * 100 in `i'
  8. 
  9.     replace CDU = r(mean) * 100 in `i'
 10. 
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)
(1 real change made)



------------------------------------------------------------------------------
     year |             SPD          Liberal              CDU  Total_Switching
----------+-------------------------------------------------------------------
     2002 |            10.6             12.0              1.5              7.1
     2005 |             0.4              8.1              4.1              5.0
     2009 |             1.9              9.1              0.9              3.8
     2013 |             9.8             22.2              3.1              6.7
        . |                                                                   
------------------------------------------------------------------------------
\end{verbatim}

\hypertarget{switching-cross-sectional-based-on-ess-1_4_switching_appendix_ess.do}{%
\subsection{Switching Cross-sectional based on ESS
{[}1\_4\_Switching\_Appendix\_ESS.do{]}}\label{switching-cross-sectional-based-on-ess-1_4_switching_appendix_ess.do}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Load }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\KeywordTok{use} \StringTok{"Data\textbackslash{}Appendix\_ESS.dta"}\NormalTok{, }\KeywordTok{clear} 
\end{Highlighting}
\end{Shaded}

\hypertarget{table-a11-switching-in-western-european-countries-from-mainstream-left-to-outsider-radical-right-parties-2002-2018}{%
\subsubsection{Table A11: Switching in Western European Countries from
Mainstream Left to Outsider Radical Right parties
2002-2018}\label{table-a11-switching-in-western-european-countries-from-mainstream-left-to-outsider-radical-right-parties-2002-2018}}

\begin{Shaded}
\begin{Highlighting}[]

\CommentTok{// table A11: Switching in Western European Countries from Mainstream Left to Outsider Radical Right parties 2002{-}2018}
\NormalTok{\{}
\NormalTok{eststo }\KeywordTok{clear}  \CommentTok{// Clear any previously stored estimates}

\CommentTok{// Estimate logistic regression for \textquotesingle{}switching2\textquotesingle{} with various predictors, storing the results. First results are swithing from any party. }
\NormalTok{eststo:  }\KeywordTok{logit}\NormalTok{ switching2  meanprobfreyosborne  unemplindiv2 female agea mbtru2 rlgdgr    i.country2 i.}\FunctionTok{year}  \KeywordTok{if}\NormalTok{ west2==1, }\KeywordTok{cluster}\NormalTok{(countr\_year)}
\NormalTok{eststo:  }\KeywordTok{logit}\NormalTok{ switching2  rti   unemplindiv2  female agea mbtru2 rlgdgr     i.country2 i.}\FunctionTok{year} \KeywordTok{if}\NormalTok{ west2==1, }\KeywordTok{cluster}\NormalTok{(countr\_year)}
\NormalTok{eststo:  }\KeywordTok{logit}\NormalTok{ switching2  task3cog2and3   unemplindiv2  female agea mbtru2 rlgdgr i.country2 i.}\FunctionTok{year}  \KeywordTok{if}\NormalTok{ west2==1, }\KeywordTok{cluster}\NormalTok{(countr\_year)}

\CommentTok{// Estimate logistic regression for \textquotesingle{}switching2\_leftboth\textquotesingle{} (switching from left parties to nationalist) with various predictors, storing the results}
\NormalTok{eststo:  }\KeywordTok{logit}\NormalTok{ switching2\_leftboth  meanprobfreyosborne  unemplindiv2 female agea mbtru2 rlgdgr     i.country2 i.}\FunctionTok{year}   \KeywordTok{if}\NormalTok{ west2==1, }\KeywordTok{cluster}\NormalTok{(countr\_year)}
\NormalTok{eststo:  }\KeywordTok{logit}\NormalTok{ switching2\_leftboth  rti  unemplindiv2   female agea  mbtru2 rlgdgr    i.country2 i.}\FunctionTok{year}  \KeywordTok{if}\NormalTok{ west2==1 , }\KeywordTok{cluster}\NormalTok{(countr\_year)}
\NormalTok{eststo:  }\KeywordTok{logit}\NormalTok{ switching2\_leftboth  task3cog2and3  unemplindiv2    female agea mbtru2 rlgdgr     i.country2 i.}\FunctionTok{year}  \KeywordTok{if}\NormalTok{ west2==1 , }\KeywordTok{cluster}\NormalTok{(countr\_year)}

\CommentTok{// Generate an output table with specific variables, saving it in the current results}
    


\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{   esttab   }\CommentTok{///}
\NormalTok{        , }\KeywordTok{keep}\NormalTok{(meanprobfreyosborne task3cog2and3 rti) }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) }\CommentTok{///}
\NormalTok{        b(\%6.3f) scalars( }\StringTok{"N Observations"}\NormalTok{  )   }\CommentTok{///}
\NormalTok{        indicate(}\StringTok{"Demographics = *male*"} \StringTok{"Socio{-}econ = *mbtru2*"}   \StringTok{"Country FE = *country*"} \StringTok{"Year FE = *year"}\NormalTok{, }\KeywordTok{label}\NormalTok{($\textbackslash{}checkmark$ ))    }\CommentTok{///}
        \KeywordTok{noconstant} \KeywordTok{nonotes}\NormalTok{ nomtitles nodepvars}

\NormalTok{   esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}ESS\_switching.tex"}\NormalTok{, }\CommentTok{///}
         \KeywordTok{keep}\NormalTok{(meanprobfreyosborne task3cog2and3 rti) }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) }\CommentTok{///}
\NormalTok{        b(\%6.3f) scalars( }\StringTok{"N Observations"}\NormalTok{  )   }\CommentTok{///}
\NormalTok{        indicate(}\StringTok{"Demographics = *male*"} \StringTok{"Socio{-}econ = *mbtru2*"}   \StringTok{"Country FE = *country*"} \StringTok{"Year FE = *year"}\NormalTok{, }\KeywordTok{label}\NormalTok{($\textbackslash{}checkmark$ ))    }\CommentTok{///}
        \KeywordTok{noconstant} \KeywordTok{nonotes}\NormalTok{ nomtitles nodepvars}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
                       (1)          (2)          (3)          (4)          (5) 
>          (6)   
-------------------------------------------------------------------------------
> ---------------
main                                                                           
>                
Computerizatio~)     0.626***                               0.850***           
>                
                   (0.077)                                (0.226)              
>                
RTI                               0.044*                                 0.112*
>                
                                (0.024)                                (0.063) 
>                
Routine                                        0.698***                        
>        0.833***
                                             (0.056)                           
>      (0.157)   
Demographics     $\check~$    $\check~$    $\check~$    $\check~$    $\check~$ 
>    $\check~$   
Socio-econ       $\check~$    $\check~$    $\check~$    $\check~$    $\check~$ 
>    $\check~$   
Country FE       $\check~$    $\check~$    $\check~$    $\check~$    $\check~$ 
>    $\check~$   
Year FE          $\check~$    $\check~$    $\check~$    $\check~$    $\check~$ 
>    $\check~$   
-------------------------------------------------------------------------------
> ---------------
Observations        148688       153158       174298       136250       151345 
>       172359   
-------------------------------------------------------------------------------
> ---------------

(output written to Table\ESS_switching.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A11}

% Include the table with custom numbering
\input{Table/ESS_switching.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\begin{verbatim}
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{6}{c}}
\hline\hline
                &\multicolumn{1}{c}{(1)}         &\multicolumn{1}{c}{(2)}         &\multicolumn{1}{c}{(3)}         &\multicolumn{1}{c}{(4)}         &\multicolumn{1}{c}{(5)}         &\multicolumn{1}{c}{(6)}         \\
\hline
main            &                  &                  &                  &                  &                  &                  \\
Computerization (F\&O)&    0.626\sym{***}&                  &                  &    0.850\sym{***}&                  &                  \\
                &  (0.077)         &                  &                  &  (0.226)         &                  &                  \\
RTI             &                  &    0.044\sym{*}  &                  &                  &    0.112\sym{*}  &                  \\
                &                  &  (0.024)         &                  &                  &  (0.063)         &                  \\
Routine         &                  &                  &    0.698\sym{***}&                  &                  &    0.833\sym{***}\\
                &                  &                  &  (0.056)         &                  &                  &  (0.157)         \\
Demographics    &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         \\
Socio-econ      &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         \\
Country FE      &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         \\
Year FE         &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         &$\checkmark$         \\
\hline
Observations    &   148688         &   153158         &   174298         &   136250         &   151345         &   172359         \\
\hline\hline
\end{tabular}
}
\end{verbatim}

\hypertarget{messaging-and-targeting-strategies-candidate-rhetoric-and-party-platforms}{%
\section{Messaging and Targeting Strategies: Candidate Rhetoric and
Party
Platforms}\label{messaging-and-targeting-strategies-candidate-rhetoric-and-party-platforms}}

\hypertarget{majoritarian-systems-messaging-and-targeting-strategies-in-the-us}{%
\subsection{Majoritarian Systems: Messaging and Targeting Strategies in
the
US}\label{majoritarian-systems-messaging-and-targeting-strategies-in-the-us}}

\hypertarget{topic-analysis-2_3_speech_us_germany_appendix_nmf.ipynb}{%
\subsubsection{Topic Analysis
{[}2\_3\_Speech\_US\_Germany\_Appendix\_NMF.ipynb{]}}\label{topic-analysis-2_3_speech_us_germany_appendix_nmf.ipynb}}

This file:

\begin{itemize}
\tightlist
\item
  Creates inputs for Table A17: NMF Topic Modeling.
\item
  First it does the NMF for the US, then for Germany.
\item
  Once topic are created the proportion of each one of them is
  calculated.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data/cleaned\_data.csv} \# Data for the US
\item
  \texttt{Data/cleaned\_data\_G.csv} \# Data for Germany
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  Inputs for Table A17: NMF Topic Modeling, 4 clusters, top-10 terms.
\end{itemize}

\hypertarget{rallies-2_1_rally_us.do}{%
\subsubsection{Rallies
{[}2\_1\_Rally\_US.do{]}}\label{rallies-2_1_rally_us.do}}

This do-file:

\begin{itemize}
\tightlist
\item
  Creates table A13 using data collected for rallies, visits, and
  exposure to automation.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data\textbackslash{}Rally\_Visits\_MSA.dta}
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  Table 1: Trump's Campaign Strategy (Close election 5)
  {[}\texttt{Table\textbackslash{}Trump\_high\_close5.tex}{]}
\item
  Table A13: Trump's Campaing Strategy (Close election 10)
  {[}\texttt{Table\textbackslash{}Trump\_high\_close10.tex}{]}
\item
  Table A14: Trump's Campaing Strategy (Forecasting 2016)
  {[}\texttt{Table\textbackslash{}Trump\_high\_forec.tex}{]}
\item
  Table A12: Summary statistics of variables used in this study about
  Trump's campaign strategies: rallies
  {[}\texttt{Table\textbackslash{}US\_rallies\_descriptive.tex}{]}
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*Calling the }\KeywordTok{data}
\KeywordTok{use} \StringTok{"Data\textbackslash{}Rally\_Visits\_MSA.dta"}\NormalTok{, }\KeywordTok{clear} 
\end{Highlighting}
\end{Shaded}

\hypertarget{table-1-trumps-campaign-strategy}{%
\paragraph{Table 1: Trump's Campaign
Strategy}\label{table-1-trumps-campaign-strategy}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// table 1: Trump\textquotesingle{}s Campaign Strategy}
\NormalTok{\{}
\KeywordTok{gen}\NormalTok{ interaction\_pop5=high\_pop\_pop*close\_election5}
\KeywordTok{gen}\NormalTok{ interaction2\_pop5=high\_pop\_pop*close\_election5}
\KeywordTok{gen}\NormalTok{ interaction3\_pop5=high\_pop\_pop*anti\_pop}
\KeywordTok{gen}\NormalTok{ interaction4\_pop5=close\_election5*anti\_pop}

\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction\_pop5 }\StringTok{"Exposed x Close Elections"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction2\_pop5 }\StringTok{"Exposed x Close Elections"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction3\_pop5 }\StringTok{"Exposed x Hate Incidents"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction4\_pop5 }\StringTok{"Hate Incidents x Close"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ close\_election5 }\StringTok{"Close Elections"}


\NormalTok{eststo }\KeywordTok{clear}

\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop close\_election5  anti\_pop }\OtherTok{$statesID}\NormalTok{ , }\KeywordTok{cluster}\NormalTok{(state\_num)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop close\_election5   interaction2\_pop5  anti\_pop }\OtherTok{$statesID}\NormalTok{ ,}\KeywordTok{cluster}\NormalTok{(state\_num)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop close\_election5   interaction3\_pop5  anti\_pop }\OtherTok{$statesID}\NormalTok{ ,}\KeywordTok{cluster}\NormalTok{(state\_num)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop close\_election5  interaction2\_pop5 interaction3\_pop5 interaction4\_pop5  anti\_pop }\OtherTok{$statesID}\NormalTok{   ,}\KeywordTok{cluster}\NormalTok{(state\_num)}

\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Trump\textquotesingle{}s Campaing Strategy \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableRallies\})  mti(}\StringTok{"Simple"} \StringTok{"Close"} \StringTok{"Hate"} \StringTok{"All"}\NormalTok{)  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(high* anti\_pop close\_election* interaction*) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )  indicate(}\StringTok{"FE State = *AK"}\NormalTok{) }



\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)

Trump's Campaing Strategy \label {TableRallies}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                    Simple        Close         Hate          All   
--------------------------------------------------------------------
Workers Expose~n     0.194***     0.177**      0.169**      0.155** 
                   (0.071)      (0.070)      (0.065)      (0.066)   
Close Elections      0.005*       0.001        0.007**      0.002   
                   (0.003)      (0.005)      (0.003)      (0.005)   
Hate Incidents~p    -0.052*      -0.051*       0.015        0.015   
                   (0.029)      (0.029)      (0.031)      (0.035)   
Exposed x Clos~s                  0.344***                  0.331***
                                (0.071)                   (0.091)   
Exposed x Hate~s                              -0.259       -0.249   
                                             (0.156)      (0.164)   
Hate Incidents~e                                           -0.033   
                                                          (0.031)   
FE State               Yes          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations           381          381          381          381   
R$^2$                0.661        0.674        0.681        0.689   
AIC               -2.2e+03     -2.2e+03     -2.2e+03     -2.3e+03   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}Trump\_high\_close5.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Trump\textquotesingle{}s Campaing Strategy \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableRallies\})  mti(}\StringTok{"Simple"} \StringTok{"Close"} \StringTok{"Hate"} \StringTok{"All"}\NormalTok{)   }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(high* anti\_pop close\_election* interaction*)  indicate(}\StringTok{"FE State = *AK"}\NormalTok{ ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\Trump_high_close5.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{1}

% Include the table with custom numbering
\input{Table/Trump_high_close5.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a13-trumps-campaing-strategy-close-election-10}{%
\paragraph{Table A13: Trump's Campaing Strategy (Close election
10)}\label{table-a13-trumps-campaing-strategy-close-election-10}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// table A13: Trump\textquotesingle{}s Campaing Strategy (Close election 10)}
\NormalTok{\{}
\KeywordTok{gen}\NormalTok{ interaction\_pop=high\_pop\_pop*close\_election}
\KeywordTok{gen}\NormalTok{ interaction2\_pop=high\_pop\_pop*close\_election}
\KeywordTok{gen}\NormalTok{ interaction3\_pop=high\_pop\_pop*anti\_pop}
\KeywordTok{gen}\NormalTok{ interaction4\_pop=close\_election*anti\_pop}


\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction\_pop }\StringTok{"Exposed x Close Elections"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction2\_pop }\StringTok{"Exposed x Close Elections"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction3\_pop }\StringTok{"Exposed x Hate Incidents"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction4\_pop }\StringTok{"Hate Incidents x Close"}


\NormalTok{eststo }\KeywordTok{clear}

\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop close\_election  anti\_pop }\OtherTok{$statesID}\NormalTok{ , }\KeywordTok{cluster}\NormalTok{(state\_num)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop close\_election interaction2\_pop  anti\_pop }\OtherTok{$statesID}\NormalTok{ ,}\KeywordTok{cluster}\NormalTok{(state\_num)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop close\_election   interaction3\_pop  anti\_pop }\OtherTok{$statesID}\NormalTok{ ,}\KeywordTok{cluster}\NormalTok{(state\_num)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop close\_election  interaction2\_pop interaction3\_pop interaction4\_pop  anti\_pop }\OtherTok{$statesID}\NormalTok{ ,}\KeywordTok{cluster}\NormalTok{(state\_num)}

\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Trump\textquotesingle{}s Campaing Strategy \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableRallies\})  mti(}\StringTok{"Simple"} \StringTok{"Close"} \StringTok{"Hate"} \StringTok{"All"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(high* anti\_pop close\_election interaction*) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )  indicate(}\StringTok{"FE State = *AK"}\NormalTok{) }



\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)

Trump's Campaing Strategy \label {TableRallies}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                    Simple        Close         Hate          All   
--------------------------------------------------------------------
Workers Expose~n     0.191***     0.052*       0.167***     0.062   
                   (0.067)      (0.029)      (0.062)      (0.039)   
Close Elections      0.016**      0.006        0.015**      0.006   
                   (0.006)      (0.004)      (0.006)      (0.004)   
Hate Incidents~p    -0.048*      -0.040        0.016       -0.023   
                   (0.028)      (0.026)      (0.030)      (0.050)   
Exposed x Clos~s                  0.301***                  0.238***
                                (0.077)                   (0.088)   
Exposed x Hate~s                              -0.249       -0.075   
                                             (0.156)      (0.185)   
Hate Incidents~e                                            0.016   
                                                          (0.038)   
FE State               Yes          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations           381          381          381          381   
R$^2$                0.671        0.727        0.689        0.731   
AIC               -2.2e+03     -2.3e+03     -2.3e+03     -2.3e+03   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}Trump\_high\_close10.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Trump\textquotesingle{}s Campaing Strategy (Close election 10) \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableRallies10\})  mti(}\StringTok{"Simple"} \StringTok{"Close"} \StringTok{"Hate"} \StringTok{"All"}\NormalTok{)  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(high* anti\_pop close\_election* interaction*)  indicate(}\StringTok{"FE State = *AK"}\NormalTok{ ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\Trump_high_close10.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A6}

% Include the table with custom numbering
\input{Table/Trump_high_close10.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a14-trumps-campaing-strategy-forecasting-2016}{%
\paragraph{Table A14: Trump's Campaing Strategy (Forecasting
2016)}\label{table-a14-trumps-campaing-strategy-forecasting-2016}}

\begin{Shaded}
\begin{Highlighting}[]

\CommentTok{//table A14: Trump\textquotesingle{}s Campaing Strategy (Forecasting 2016)}
\NormalTok{\{}
\KeywordTok{gen}\NormalTok{ interaction\_pop\_f=high\_pop\_pop*forescasting2}
\KeywordTok{gen}\NormalTok{ interaction2\_pop\_f=high\_pop\_pop*forescasting2}
\KeywordTok{gen}\NormalTok{ interaction3\_pop\_f=high\_pop\_pop*anti\_pop}
\KeywordTok{gen}\NormalTok{ interaction4\_pop\_f=forescasting2*anti\_pop}

\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction\_pop\_f }\StringTok{"Exposed x Close Elections"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction2\_pop\_f }\StringTok{"Exposed x Close Elections"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction3\_pop\_f }\StringTok{"Exposed x Hate Incidents"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ interaction4\_pop\_f }\StringTok{"Hate Incidents x Close"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ forescasting2 }\StringTok{"Close Elections"}

\NormalTok{eststo }\KeywordTok{clear}

\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop forescasting2  anti\_pop }\OtherTok{$statesID}\NormalTok{ , }\KeywordTok{cluster}\NormalTok{(state\_num)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop forescasting2 interaction2\_pop\_f  anti\_pop }\OtherTok{$statesID}\NormalTok{ ,}\KeywordTok{cluster}\NormalTok{(state\_num)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop forescasting2   interaction3\_pop\_f  anti\_pop }\OtherTok{$statesID}\NormalTok{ ,}\KeywordTok{cluster}\NormalTok{(state\_num)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ rallies\_pop high\_pop\_pop forescasting2  interaction2\_pop\_f interaction3\_pop\_f interaction4\_pop\_f  anti\_pop }\OtherTok{$statesID}\NormalTok{ ,}\KeywordTok{cluster}\NormalTok{(state\_num)}

\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Trump\textquotesingle{}s Campaing Strategy \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableRallies\})  mti(}\StringTok{"Simple"} \StringTok{"Close"} \StringTok{"Hate"} \StringTok{"All"}\NormalTok{)  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(high* anti\_pop forescasting2 interaction*) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )   indicate(}\StringTok{"FE State = *AK"}\NormalTok{) }


\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)

Trump's Campaing Strategy \label {TableRallies}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                    Simple        Close         Hate          All   
--------------------------------------------------------------------
Workers Expose~n     0.192***     0.162**      0.168**      0.140** 
                   (0.071)      (0.065)      (0.065)      (0.061)   
Close Elections     -0.019***    -0.025***    -0.019***    -0.025***
                   (0.006)      (0.006)      (0.005)      (0.006)   
Hate Incidents~p    -0.051*      -0.049*       0.015        0.017   
                   (0.030)      (0.029)      (0.031)      (0.035)   
Exposed x Clos~s                  0.315***                  0.353***
                                (0.055)                   (0.080)   
Exposed x Hate~s                              -0.256       -0.252   
                                             (0.156)      (0.165)   
Hate Incidents~e                                           -0.043   
                                                          (0.034)   
FE State               Yes          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations           381          381          381          381   
R$^2$                0.662        0.678        0.681        0.694   
AIC               -2.2e+03     -2.2e+03     -2.2e+03     -2.3e+03   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}Trump\_high\_forec.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Trump\textquotesingle{}s Campaing Strategy (Forecasting 2016) \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableRallies\})  mti(}\StringTok{"Simple"} \StringTok{"Close"} \StringTok{"Hate"} \StringTok{"All"}\NormalTok{)  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(high* anti\_pop forescasting2 interaction*)  indicate(}\StringTok{"FE State = *AK"}\NormalTok{ ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\Trump_high_forec.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A14}

% Include the table with custom numbering
\input{Table/Trump_high_forec.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a12-summary-statistics-of-variables-used-in-this-study-about-trumps-campaign-strategies-rallies}{%
\paragraph{Table A12: Summary statistics of variables used in this study
about Trump's campaign strategies:
rallies}\label{table-a12-summary-statistics-of-variables-used-in-this-study-about-trumps-campaign-strategies-rallies}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{////////////////////////////////////}
\NormalTok{* Descriptives}
\CommentTok{///////////////////////////////////}

\NormalTok{lab }\KeywordTok{var}\NormalTok{ rallies }\StringTok{"\textbackslash{}\# Rallies per MSA"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ visited }\StringTok{"Visit MSA (dummy)"}

\NormalTok{lab }\KeywordTok{var}\NormalTok{ rallies\_pop }\StringTok{"\textbackslash{}\# Rallies relative to population"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ visits\_pop }\StringTok{"Visit (dummy) relative to population"}

\NormalTok{lab }\KeywordTok{var}\NormalTok{ close\_election5 }\StringTok{"Close election 2012 (5\textbackslash{}\%)"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ forescasting2 }\StringTok{"Close election {-} Forecasting 2016"}

\NormalTok{lab }\KeywordTok{var}\NormalTok{ close\_election }\StringTok{"Close election 2012 (10\textbackslash{}\%)"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ anti }\StringTok{"\textbackslash{}\# Hate incident per MSA"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ high\_pop\_pop }\StringTok{"Workers Exposed to Automation (relative to pop.)"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ high }\StringTok{"Workers Exposed to Automation (relative to MSA)"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ high\_pop }\StringTok{"\textbackslash{}\# Workers Exposed to Automation per MSA"}
\end{Highlighting}
\end{Shaded}

\begin{Shaded}
\begin{Highlighting}[]

\CommentTok{// table A12: Summary statistics of variables used in this study about Trump\textquotesingle{}s campaign strategies: rallies}

\NormalTok{eststo }\KeywordTok{clear}

\KeywordTok{qui}\NormalTok{ estpost }\KeywordTok{sum}\NormalTok{ rallies rallies\_pop visited visits\_pop high\_pop high high\_pop\_pop  anti anti\_pop close\_election5 forescasting2 close\_election, }\KeywordTok{d}
\NormalTok{esttab , }\CommentTok{///}
\NormalTok{    cells(}\StringTok{"mean(label(Mean) fmt(2)) p50(label(Median) fmt(2)) sd(label(S.D.) fmt(2)) min(label(Min.) fmt(2)) max(label(Max) fmt(2)) count(label(Obs.) fmt(0))"}\NormalTok{) }\CommentTok{///}
\NormalTok{    nonumber }\KeywordTok{label} \KeywordTok{replace} \KeywordTok{noobs}
    
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}US\_rallies\_descriptive.tex"}\NormalTok{, }\CommentTok{///}
\NormalTok{    cells(}\StringTok{"mean(label(Mean) fmt(2)) p50(label(Median) fmt(2)) sd(label(S.D.) fmt(2)) min(label(Min.) fmt(2)) max(label(Max) fmt(2)) count(label(Obs.) fmt(0))"}\NormalTok{) }\CommentTok{///}
\NormalTok{    nonumber }\KeywordTok{label} \KeywordTok{replace} \KeywordTok{noobs}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
                             Mean       Median         S.D.         Min.       
>    Max         Obs.
-------------------------------------------------------------------------------
> -------------------
\# Rallies per MSA           0.35         0.00         0.82         0.00       
>   4.00          381
\# Rallies relativ~o         0.01         0.00         0.02         0.00       
>   0.29          381
Visit MSA (dummy)            0.20         0.00         0.40         0.00       
>   1.00          381
Visit (dummy) rela~a         0.00         0.00         0.01         0.00       
>   0.07          381
\# Workers Exposed~n    182502.35     63114.92    386542.94     14190.64   4128
> 796.25          381
Workers Exposed to~r         0.26         0.26         0.03         0.18       
>   0.42          381
Workers Expos..)             0.02         0.01         0.04         0.00       
>   0.30          381
\# Hate incident p~A         3.75         0.00        19.92         0.00       
> 329.00          381
Hate Incidents Per~p         0.04         0.00         0.20         0.00       
>   2.46          381
Close election 201~)         0.15         0.00         0.36         0.00       
>   1.00          381
Close election -~201         0.11         0.00         0.31         0.00       
>   1.00          381
Close election 201~)         0.42         0.00         0.49         0.00       
>   1.00          381
-------------------------------------------------------------------------------
> -------------------

(output written to Table\US_rallies_descriptive.tex)
\end{verbatim}

\renewcommand{\thetable}{A1}

\begin{table}[htbp]
    \centering
    \resizebox{\textwidth}{!}{%
        \input{Table/US_rallies_descriptive.tex}
    }
    \caption{Summary statistics of variables used in this study about Trump's campaign strategies: rallies}
\end{table}

\renewcommand{\thetable}{\arabic{table}}

\begin{verbatim}
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{1}{cccccc}}
\hline\hline
                    &\multicolumn{6}{c}{}                                                         \\
                    &        Mean&      Median&        S.D.&        Min.&         Max&        Obs.\\
\hline
\# Rallies per MSA  &        0.35&        0.00&        0.82&        0.00&        4.00&         381\\
\# Rallies relative to population&        0.01&        0.00&        0.02&        0.00&        0.29&         381\\
Visit MSA (dummy)   &        0.20&        0.00&        0.40&        0.00&        1.00&         381\\
Visit (dummy) relative to population&        0.00&        0.00&        0.01&        0.00&        0.07&         381\\
\# Workers Exposed to Automation per MSA&   182502.35&    63114.92&   386542.94&    14190.64&  4128796.25&         381\\
Workers Exposed to Automation (relative to MSA)&        0.26&        0.26&        0.03&        0.18&        0.42&         381\\
Workers Exposed to Automation (relative to pop.)&        0.02&        0.01&        0.04&        0.00&        0.30&         381\\
\# Hate incident per MSA&        3.75&        0.00&       19.92&        0.00&      329.00&         381\\
Hate Incidents Per 100K Pop&        0.04&        0.00&        0.20&        0.00&        2.46&         381\\
Close election 2012 (5\%)&        0.15&        0.00&        0.36&        0.00&        1.00&         381\\
Close election - Forecasting 2016&        0.11&        0.00&        0.31&        0.00&        1.00&         381\\
Close election 2012 (10\%)&        0.42&        0.00&        0.49&        0.00&        1.00&         381\\
\hline\hline
\end{tabular}
}
\end{verbatim}

\hypertarget{campaign-rhetoric-preparing-2_0_speech_us_dictionaries.ipynb}{%
\subsubsection{Campaign Rhetoric Preparing
{[}2\_0\_Speech\_US\_dictionaries.ipynb{]}}\label{campaign-rhetoric-preparing-2_0_speech_us_dictionaries.ipynb}}

This file:

\begin{itemize}
\tightlist
\item
  Creates dictionaries, and applies them to all Trump speeches in the
  sample.
\item
  These are inputs for the regression analysis conducted in
  \texttt{2\_2\_Speech\_US.do}
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data/Text/Rallies\_MSA.xlsx} It is a xlsx file which contains
  data on the MSA and an identifier to merge with other files for the
  analysis.
\item
  \texttt{Data/Text/Presidential...} All txt files. From
  \url{https://www.presidency.ucsb.edu/}
\item
  \texttt{Data/Text/Youtube...} All txt files. Additional rallies
  obtained from Youtube.
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  \texttt{Data/combined\_df.csv} It is a csv file with the scores per
  each speech.
\end{itemize}

\textbf{NOTE: the code for this file can be accessed in the jupyter
notebook in the folder \texttt{do}.}

\hypertarget{campaign-rhetoric-analysis-2_2_speech_us.do}{%
\subsubsection{Campaign Rhetoric Analysis
{[}2\_2\_Speech\_US.do{]}}\label{campaign-rhetoric-analysis-2_2_speech_us.do}}

This do-file:

\begin{itemize}
\tightlist
\item
  Creates Table 2 and A15 using data from Trump Speeches.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data\textbackslash{}Text\textbackslash{}combined\_df.csv} //
  This file contains the data from speeches
\item
  \texttt{Data\textbackslash{}Rally\_Visits\_MSA.dta} // This file
  contains information about the MSA (e.g, number of exposed workers)
\item
  Alternatively you can go to line 45 and use prepared data:

  \begin{itemize}
  \tightlist
  \item
    \texttt{Data\textbackslash{}Speech\_MSA.dta}
  \end{itemize}
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  Table 2: Trump's Campaign Strategy: Speeches
  {[}\texttt{Table\textbackslash{}Trump\_text\_IVchanged.tex}{]}
\item
  Table A15: Trump's Campaing Strategy: Speeches (Total count)
  {[}\texttt{Table\textbackslash{}Trump\_text\_IVchanged\_count.tex}{]}
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Alternatively }\KeywordTok{load}\NormalTok{ prepared }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}Speech\_MSA.dta"}\NormalTok{, }\KeywordTok{clear} 
    
\end{Highlighting}
\end{Shaded}

\begin{Shaded}
\begin{Highlighting}[]

\NormalTok{*******************************************************************************}
\NormalTok{* Preparing variables}
\NormalTok{*******************************************************************************}
\NormalTok{\{}
\KeywordTok{encode}\NormalTok{ state, }\KeywordTok{generate}\NormalTok{(state\_num2)  }\CommentTok{// Encode \textquotesingle{}state\textquotesingle{} as numeric}
\KeywordTok{encode}\NormalTok{ msa\_state, }\KeywordTok{generate}\NormalTok{(msa\_num)  }\CommentTok{// Encode \textquotesingle{}msa\_state\textquotesingle{} as numeric}

\CommentTok{// Calculate word shares}
\KeywordTok{gen}\NormalTok{ pro\_w = pro\_worker\_count / word\_count  }\CommentTok{// Pro{-}worker word share}
\KeywordTok{gen}\NormalTok{ pro\_c = culture\_count / word\_count  }\CommentTok{// Pro{-}culture word share}

\CommentTok{// Create interaction terms}
\KeywordTok{gen}\NormalTok{ int\_exp\_close = high\_pop\_pop * veryclose10  }\CommentTok{// Interaction: exposure x closeness}
\KeywordTok{gen}\NormalTok{ int\_exp\_anti = high\_pop\_pop * anti\_pop  }\CommentTok{// Interaction: exposure x hate incidents}

\CommentTok{// Label variables}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ veryclose10 }\StringTok{"Close"}  
\NormalTok{lab }\KeywordTok{var}\NormalTok{ int\_exp\_close }\StringTok{"Exposed x Close"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ int\_exp\_anti }\StringTok{"Exposed x Hate"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ high\_pop\_pop }\StringTok{"Workers Exp. to Auto."}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ anti\_pop }\StringTok{"Hate Inc.x 100K Pop"}
\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\hypertarget{table-2-trumps-campaign-strategy-speeches}{%
\paragraph{Table 2: Trump's Campaign Strategy:
Speeches}\label{table-2-trumps-campaign-strategy-speeches}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*****************************************}
\NormalTok{* Regression}
\NormalTok{*****************************************}
  

\CommentTok{//table 2: Trump\textquotesingle{}s Campaign Strategy: Speeches}
\NormalTok{\{}
\KeywordTok{preserve}  \CommentTok{// Preserve the current dataset}

\KeywordTok{keep} \KeywordTok{if}\NormalTok{ msa\_num \textasciitilde{}= .  }\CommentTok{// Keep observations with non{-}missing \textquotesingle{}msa\_num\textquotesingle{} (0 observations deleted)}

\NormalTok{eststo }\KeywordTok{clear}  \CommentTok{// Clear any previously stored estimates}

\CommentTok{// DV: Share of pro{-}worker rhetoric}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ pro\_w high\_pop\_pop veryclose10 i.}\FunctionTok{month}\NormalTok{ foreign anti\_pop  i.state\_num2, }\KeywordTok{cluster}\NormalTok{(state\_num2)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ pro\_w high\_pop\_pop veryclose10 int\_exp\_close  i.}\FunctionTok{month}\NormalTok{ foreign anti\_pop  i.state\_num2, }\KeywordTok{cluster}\NormalTok{(state\_num2)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ pro\_w high\_pop\_pop veryclose10 int\_exp\_close int\_exp\_anti i.}\FunctionTok{month}\NormalTok{ foreign anti\_pop  i.state\_num2,}\KeywordTok{cluster}\NormalTok{(state\_num2)}

\CommentTok{// DV: Share of pro{-}culture rhetoric}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ pro\_c high\_pop\_pop veryclose10 i.}\FunctionTok{month}\NormalTok{ foreign anti\_pop i.state\_num2 ,}\KeywordTok{cluster}\NormalTok{(state\_num2)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ pro\_c high\_pop\_pop veryclose10 int\_exp\_close i.}\FunctionTok{month}\NormalTok{ foreign anti\_pop  i.state\_num2, }\KeywordTok{cluster}\NormalTok{(state\_num2)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ pro\_c high\_pop\_pop veryclose10 int\_exp\_close int\_exp\_anti i.}\FunctionTok{month}\NormalTok{ foreign anti\_pop  i.state\_num2,}\KeywordTok{cluster}\NormalTok{(state\_num2)}

\CommentTok{// Create regression table}

    

\KeywordTok{restore}  \CommentTok{// Restore the original dataset}

\CommentTok{/////}
\NormalTok{\}}

  
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(0 observations deleted)
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)
(est5 stored)
(est6 stored)
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// Save regression table to a .tex file}
\CommentTok{// Create regression table}
\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\CommentTok{///}
    \BaseNTok{title}\NormalTok{(}\StringTok{"Trump\textquotesingle{}s Campaign Strategy \textbackslash{}label \{TableSpeech2\}"}\NormalTok{) }\CommentTok{///}
    \KeywordTok{compress}\NormalTok{ nogap }\CommentTok{///}
    \KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) }\CommentTok{///}
\NormalTok{    b(\%6.3f) }\CommentTok{///}
    \KeywordTok{keep}\NormalTok{(high\_pop* anti* *}\KeywordTok{close}\NormalTok{* }\KeywordTok{int}\NormalTok{*) }\CommentTok{///}
\NormalTok{    scalars(}\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{) }\CommentTok{///}
\NormalTok{    indicate(}\StringTok{"FE State = *state*"} \StringTok{"Foreign = foreign*"} \StringTok{"FE Month = *month"}\NormalTok{) }\CommentTok{///}
\NormalTok{    nomtitle collabels(}\KeywordTok{none}\NormalTok{) mgroups(}\StringTok{"Pro{-}worker Rhetoric (1{-}3)"} \StringTok{"Cultural Rhetoric (4{-}6)"}\NormalTok{, pattern(1 0 0 1 0 0)  }\CommentTok{///}
    \KeywordTok{prefix}\NormalTok{(\textbackslash{}multicolumn\{@span\}\{c\}\{) suffix(\}) span)}
    
\CommentTok{// Create regression table}
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}Trump\_text\_IVchanged.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\CommentTok{///}
    \BaseNTok{title}\NormalTok{(}\StringTok{"Trump\textquotesingle{}s Campaign Strategy \textbackslash{}label \{TableSpeech2\}"}\NormalTok{) }\CommentTok{///}
    \KeywordTok{compress}\NormalTok{ nogap }\CommentTok{///}
    \KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) }\CommentTok{///}
\NormalTok{    b(\%6.3f) }\CommentTok{///}
    \KeywordTok{keep}\NormalTok{(high\_pop* anti* *}\KeywordTok{close}\NormalTok{* }\KeywordTok{int}\NormalTok{*) }\CommentTok{///}
\NormalTok{    scalars(}\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{) }\CommentTok{///}
\NormalTok{    indicate(}\StringTok{"FE State = *state*"} \StringTok{"Foreign = foreign*"} \StringTok{"FE Month = *month"}\NormalTok{) }\CommentTok{///}
\NormalTok{    nomtitle collabels(}\KeywordTok{none}\NormalTok{) mgroups(}\StringTok{"Pro{-}worker Rhetoric (1{-}3)"} \StringTok{"Cultural Rhetoric (4{-}6)"}\NormalTok{, pattern(1 0 0 1 0 0)  }\CommentTok{///}
    \KeywordTok{prefix}\NormalTok{(\textbackslash{}multicolumn\{@span\}\{c\}\{) suffix(\}) span)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
Trump's Campaign Strategy \label {TableSpeech2}
-------------------------------------------------------------------------------
> ---------------
                 \multicolumn{3}{c}{Pro-worker Rhetoric (1-3)} \multicolumn{3}{
> c}{Cultural Rhetoric (4-6)}
                       (1)          (2)          (3)          (4)          (5) 
>          (6)   
-------------------------------------------------------------------------------
> ---------------
Workers E.. to~.     0.444***    -2.874***    -2.693***     0.024**      0.043 
>        0.044   
                   (0.150)      (0.557)      (0.512)      (0.011)      (0.080) 
>      (0.082)   
Close               -0.041***    -0.447***    -0.410***     0.007***     0.009 
>        0.009   
                   (0.012)      (0.069)      (0.059)      (0.001)      (0.010) 
>      (0.010)   
Hate Inc.x 100~p    -0.047**     -0.051**      0.157**     -0.004**     -0.004*
> *     -0.002   
                   (0.021)      (0.019)      (0.057)      (0.001)      (0.001) 
>      (0.004)   
Exposed x Close                   3.361***     3.060***                 -0.019 
>       -0.021   
                                (0.515)      (0.446)                   (0.081) 
>      (0.084)   
Exposed x Hate                                -0.778***                        
>       -0.007   
                                             (0.210)                           
>      (0.012)   
FE State               Yes          Yes          Yes          Yes          Yes 
>          Yes   
Foreign                Yes          Yes          Yes          Yes          Yes 
>          Yes   
FE Month               Yes          Yes          Yes          Yes          Yes 
>          Yes   
-------------------------------------------------------------------------------
> ---------------
Observations            98           98           98           98           98 
>           98   
R$^2$                0.503        0.537        0.571        0.336        0.336 
>        0.337   
AIC               -320.397     -327.377     -332.854     -828.802     -828.840 
>     -826.928   
-------------------------------------------------------------------------------
> ---------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01

(output written to Table\Trump_text_IVchanged.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{2}

% Include the table with custom numbering
\input{Table/Trump_text_IVchanged.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a15-trumps-campaing-strategy-speeches-total-count}{%
\paragraph{Table A15: Trump's Campaing Strategy: Speeches (Total
count)}\label{table-a15-trumps-campaing-strategy-speeches-total-count}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// table A15: Trump\textquotesingle{}s Campaing Strategy: Speeches (Total count)}
\NormalTok{\{}
\KeywordTok{preserve}  \CommentTok{// Preserve the current dataset}

\KeywordTok{keep} \KeywordTok{if}\NormalTok{ msa\_num \textasciitilde{}= .  }\CommentTok{// Keep observations with non{-}missing \textquotesingle{}msa\_num\textquotesingle{} (0 observations deleted)}

\NormalTok{eststo }\KeywordTok{clear}  \CommentTok{// Clear any previously stored estimates}

\NormalTok{********* Now number }\KeywordTok{of}\NormalTok{ words counts instead }\KeywordTok{of}\NormalTok{ share }\KeywordTok{of}\NormalTok{ words **************}
\NormalTok{eststo }\KeywordTok{clear}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ pro\_worker\_count high\_pop\_pop  i.}\FunctionTok{month}\NormalTok{ foreign anti\_pop i.state\_num2 ,}\KeywordTok{cluster}\NormalTok{(state\_num2)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ pro\_worker\_count high\_pop\_pop veryclose10 foreign i.}\FunctionTok{month}\NormalTok{  anti\_pop  i.state\_num2, }\KeywordTok{cluster}\NormalTok{(state\_num2)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ pro\_worker\_count high\_pop\_pop veryclose10 foreign int\_exp\_close  i.}\FunctionTok{month}\NormalTok{  anti\_pop  i.state\_num2, }\KeywordTok{cluster}\NormalTok{(state\_num2)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ pro\_worker\_count high\_pop\_pop veryclose10 foreign int\_exp\_close int\_exp\_anti i.}\FunctionTok{month}\NormalTok{  anti\_pop  i.state\_num2,}\KeywordTok{cluster}\NormalTok{(state\_num2)}

\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ culture\_count high\_pop\_pop  i.}\FunctionTok{month}\NormalTok{ foreign anti\_pop  i.state\_num2 ,}\KeywordTok{cluster}\NormalTok{(state\_num2)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ culture\_count high\_pop\_pop veryclose10 foreign i.}\FunctionTok{month}\NormalTok{  anti\_pop i.state\_num2 ,}\KeywordTok{cluster}\NormalTok{(state\_num2)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ culture\_count high\_pop\_pop veryclose10 int\_exp\_close foreign i.}\FunctionTok{month}\NormalTok{  anti\_pop  i.state\_num2, }\KeywordTok{cluster}\NormalTok{(state\_num2)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ culture\_count high\_pop\_pop veryclose10 int\_exp\_close foreign int\_exp\_anti i.}\FunctionTok{month}\NormalTok{  anti\_pop  i.state\_num2,}\KeywordTok{cluster}\NormalTok{(state\_num2)}




\KeywordTok{restore}

\CommentTok{/////}
\NormalTok{\}}

  
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(0 observations deleted)
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)
(est5 stored)
(est6 stored)
(est7 stored)
(est8 stored)
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// Save regression table to a .tex file}
\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Trump\textquotesingle{}s Campaing Strategy: Speeches (Total }\FunctionTok{count}\NormalTok{) \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableTotal\})  nomtitle collabels(}\KeywordTok{none}\NormalTok{) mgroups(}\StringTok{"Pro{-}worker Rhetoric (1{-}3)"} \StringTok{"Cultural Rhetoric (4{-}6)"}\NormalTok{, pattern(1 0 0 0 1 0 0 0)  }\CommentTok{///}
    \KeywordTok{prefix}\NormalTok{(\textbackslash{}multicolumn\{@span\}\{c\}\{) suffix(\}) span) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.2f) }\KeywordTok{keep}\NormalTok{(high\_pop* anti* *}\KeywordTok{close}\NormalTok{* }\KeywordTok{int}\NormalTok{*)  scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate(}\StringTok{"FE State = *state*"} \StringTok{"Foreign = foreign*"} \StringTok{"Fe Month =*month"}\NormalTok{) }

\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}Trump\_text\_IVchanged\_count.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Trump\textquotesingle{}s Campaing Strategy: Speeches (Total }\FunctionTok{count}\NormalTok{) \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableTotal\})  nomtitle collabels(}\KeywordTok{none}\NormalTok{) mgroups(}\StringTok{"Pro{-}worker Rhetoric (1{-}4)"} \StringTok{"Cultural Rhetoric (5{-}8)"}\NormalTok{, pattern(1 0 0 0 1 0 0 0)  }\CommentTok{///}
    \KeywordTok{prefix}\NormalTok{(\textbackslash{}multicolumn\{@span\}\{c\}\{) suffix(\}) span)  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.2f) }\KeywordTok{keep}\NormalTok{(high\_pop* anti* *}\KeywordTok{close}\NormalTok{* }\KeywordTok{int}\NormalTok{*)  scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate(}\StringTok{"FE State = *state*"} \StringTok{"Foreign = foreign*"} \StringTok{"FE Month =*month"}\NormalTok{) }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
Trump's Campaing Strategy: Speeches (Total count) \label {TableTotal}
-------------------------------------------------------------------------------
> -----------------------------------------
                 \multicolumn{4}{c}{Pro-worker Rhetoric (1-3)}       \multicolu
> mn{4}{c}{Cultural Rhetoric (4-6)}        
                       (1)          (2)          (3)          (4)          (5) 
>          (6)          (7)          (8)   
-------------------------------------------------------------------------------
> -----------------------------------------
Workers E.. to~.    636.18       636.18     -4017.86***  -3658.56***    -12.97 
>       -12.97       399.21       377.56   
                  (450.61)     (450.61)    (1375.41)    (1246.38)      (40.57) 
>      (40.57)     (234.13)     (231.52)   
Hate Inc.x 100~p   -119.44*     -119.44*     -124.44*      287.08        -3.23 
>        -3.23        -2.79       -27.59   
                   (67.36)      (67.36)      (62.78)     (277.98)       (5.17) 
>       (5.17)       (4.61)      (16.76)   
Close                            198.14***   -371.74**    -297.68*             
>        63.79***    114.26***    109.80***
                                (28.05)     (168.17)     (144.97)              
>       (4.69)      (29.17)      (29.43)   
Exposed x Close                              4714.86***   4116.91***           
>                   -417.56*     -381.54*  
                                           (1243.99)    (1063.07)              
>                  (217.72)     (220.61)   
Exposed x Hate                                           -1542.64              
>                                  92.95*  
                                                         (985.93)              
>                                (51.69)   
FE State               Yes          Yes          Yes          Yes          Yes 
>          Yes          Yes          Yes   
Foreign                Yes          Yes          Yes          Yes          Yes 
>          Yes          Yes          Yes   
Fe Month               Yes          Yes          Yes          Yes          Yes 
>          Yes          Yes          Yes   
-------------------------------------------------------------------------------
> -----------------------------------------
Observations            98           98           98           98           98 
>           98           98           98   
R$^2$                 0.38         0.38         0.40         0.42         0.50 
>         0.50         0.51         0.51   
AIC                1222.34      1222.34      1220.39      1218.40       785.24 
>       785.24       783.93       784.70   
-------------------------------------------------------------------------------
> -----------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01

(output written to Table\Trump_text_IVchanged_count.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A15}

% Include the table with custom numbering
\input{Table/Trump_text_IVchanged_count.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{pritm-systems-time-series-cross-sectional-evidence-on-messaging}{%
\subsection{PRITM Systems: Time-Series-Cross-Sectional Evidence on
Messaging}\label{pritm-systems-time-series-cross-sectional-evidence-on-messaging}}

\hypertarget{cmp-main-analysis-3_2_cmp_pritm.do}{%
\subsubsection{CMP main analysis
{[}3\_2\_CMP\_PRITM.do{]}}\label{cmp-main-analysis-3_2_cmp_pritm.do}}

This do-file:

\begin{verbatim}
A. Call the Data
B. Define variables
C. Export Tables 
\end{verbatim}

Input: \textbf{Manifesto Project database}

\begin{verbatim}
- Data\CMP\MPDataset_MPDS2020a_stata14.dta // Data download from https://manifesto-project.wzb.eu/datasets 
\end{verbatim}

Final output:

\begin{itemize}
\item
  Cleaned data:

  \begin{itemize}
  \tightlist
  \item
    \texttt{Data\textbackslash{}CMP\_main.dta} this data contains the
    relevant variables for the analysis with the DV as the polarization
    over redistribution, and fixed-value positions, estimated as the
    distance between establishment left and outsider parties.
  \end{itemize}
\item
  Tables:

  \begin{itemize}
  \tightlist
  \item
    table 3: PRITM: Partisan Polarization over Redistribution and Fixed
    Attributes {[}\texttt{Table\textbackslash{}TabWithin.tex}{]}
  \item
    table A19: Partisan Polarization over Redistribution and Fixed
    Attributes Different Cut-Of
    {[}\texttt{Table\textbackslash{}TabWithin\_cutoff.tex}{]}
  \item
    table A20: Alternative measures of Partisan Polarization over Fixed
    Attributes between Mainstream Left and Right-Populist
    {[}\texttt{Table\textbackslash{}TabWithin\_FValternative.tex}{]}
  \item
    table A18: Descriptive statistic: PRITM 1970-2019
    {[}\texttt{Table\textbackslash{}desc\_PRITM.tex}{]}
  \end{itemize}
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Alternatively }\KeywordTok{load}\NormalTok{ prepared }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}CMP\_main.dta"}\NormalTok{, }\KeywordTok{clear}  
    
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(Manifesto Project Dataset Version 2020a. Please type "notes" for more details)
\end{verbatim}

\hypertarget{table-3-pritm-partisan-polarization-over-redistribution-and-fixed-attributes}{%
\paragraph{Table 3: PRITM: Partisan Polarization over Redistribution and
Fixed
Attributes}\label{table-3-pritm-partisan-polarization-over-redistribution-and-fixed-attributes}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// table 3: PRITM: Partisan Polarization over Redistribution and Fixed Attributes}
\NormalTok{\{}
\KeywordTok{preserve}

\NormalTok{eststo }\KeywordTok{clear}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_redist L.distance\_redist shock totseats   oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_fixed L.distance\_fixed shock totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_redist L.distance\_redist IFR2 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_fixed L.distance\_fixed IFR2 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}



\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Polarization }\BaseNTok{over}\NormalTok{ Redistribution and Fixed Attributes  \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableCMPAll\}) mti(}\StringTok{"Redistribution"} \StringTok{"Fixed Values"} \StringTok{"Redistribution"} \StringTok{"Fixed Values"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock IFR2) scalars(}\KeywordTok{N}\NormalTok{ r2 aic) indicate(}\StringTok{"LDV = L.*"} \StringTok{"FE Year = *year"}\NormalTok{)}


\KeywordTok{restore}

\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)

Polarization over Redistribution and Fixed Attributes \label {TableCMPAll}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
                 Redistr~n    Fixed V~s    Redistr~n    Fixed V~s   
--------------------------------------------------------------------
High LMP period      2.919        2.708***                          
                   (2.304)      (0.866)                             
Robots Stock                                   0.074        0.561** 
                                             (0.215)      (0.219)   
LDV                    Yes          Yes          Yes          Yes   
FE Year                Yes          Yes          Yes          Yes   
--------------------------------------------------------------------
Observations           186          186           62           62   
r2                   0.519        0.333        0.492        0.372   
aic                783.599      768.187      291.086      285.773   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}TabWithin.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Polarization }\BaseNTok{over}\NormalTok{ Redistribution and Fixed Attributes  \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableCMPAll\}) mti(}\StringTok{"Redistribution"} \StringTok{"Fixed Values"} \StringTok{"Redistribution"} \StringTok{"Fixed Values"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock IFR2) scalars(}\KeywordTok{N}\NormalTok{ r2 aic) indicate(}\StringTok{"LDV = L.*"} \StringTok{"FE Year = *year"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\TabWithin.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{3}

% Include the table with custom numbering
\input{Table/TabWithin.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a19-partisan-polarization-over-redistribution-and-fixed-attributes-different-cut-of}{%
\paragraph{Table A19: Partisan Polarization over Redistribution and
Fixed Attributes Different
Cut-Of}\label{table-a19-partisan-polarization-over-redistribution-and-fixed-attributes-different-cut-of}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{// table A19: Partisan Polarization over Redistribution and Fixed Attributes Different Cut{-}Of}
\NormalTok{\{}
\KeywordTok{gen}\NormalTok{ shock92=.}
\KeywordTok{replace}\NormalTok{ shock92 =0 }\KeywordTok{if} \FunctionTok{year}\NormalTok{ \textgreater{} 1969 \& }\FunctionTok{year}\NormalTok{ \textless{} 1993}
\KeywordTok{replace}\NormalTok{ shock92 =1 }\KeywordTok{if}  \FunctionTok{year}\NormalTok{ \textgreater{} 1992}

\KeywordTok{gen}\NormalTok{ shock93=.}
\KeywordTok{replace}\NormalTok{ shock93 =0 }\KeywordTok{if} \FunctionTok{year}\NormalTok{ \textgreater{} 1969 \& }\FunctionTok{year}\NormalTok{ \textless{} 1994}
\KeywordTok{replace}\NormalTok{ shock93 =1 }\KeywordTok{if}  \FunctionTok{year}\NormalTok{ \textgreater{} 1993}

\KeywordTok{gen}\NormalTok{ shock96=.}
\KeywordTok{replace}\NormalTok{ shock96 =0 }\KeywordTok{if} \FunctionTok{year}\NormalTok{ \textgreater{} 1969 \& }\FunctionTok{year}\NormalTok{ \textless{} 1996}
\KeywordTok{replace}\NormalTok{ shock96 =1 }\KeywordTok{if}  \FunctionTok{year}\NormalTok{ \textgreater{} 1997}

\KeywordTok{gen}\NormalTok{ shock97=.}
\KeywordTok{replace}\NormalTok{ shock97 =0 }\KeywordTok{if} \FunctionTok{year}\NormalTok{ \textgreater{} 1969 \& }\FunctionTok{year}\NormalTok{ \textless{} 1997}
\KeywordTok{replace}\NormalTok{ shock97 =1 }\KeywordTok{if}  \FunctionTok{year}\NormalTok{ \textgreater{} 1998}

\KeywordTok{gen}\NormalTok{ shock98=.}
\KeywordTok{replace}\NormalTok{ shock98 =0 }\KeywordTok{if} \FunctionTok{year}\NormalTok{ \textgreater{} 1969 \& }\FunctionTok{year}\NormalTok{ \textless{} 1998}
\KeywordTok{replace}\NormalTok{ shock98 =1 }\KeywordTok{if}  \FunctionTok{year}\NormalTok{ \textgreater{} 1999}


\NormalTok{lab }\KeywordTok{var}\NormalTok{ shock98 }\StringTok{"Post{-}LMP"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ shock92 }\StringTok{"Post{-}LMP"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ shock93 }\StringTok{"Post{-}LMP"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ shock96 }\StringTok{"Post{-}LMP"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ shock97 }\StringTok{"Post{-}LMP"}


\KeywordTok{preserve}
  
\NormalTok{eststo }\KeywordTok{clear}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_redist L.distance\_redist shock92 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_fixed L.distance\_fixed shock92 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}

\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_redist L.distance\_redist shock93 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_fixed L.distance\_fixed shock93 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}


\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_redist L.distance\_redist shock96 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_fixed L.distance\_fixed shock96 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}


\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_redist L.distance\_redist shock97 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_fixed L.distance\_fixed shock97 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}


\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_redist L.distance\_redist shock98 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_fixed L.distance\_fixed shock98 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}

\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Partisan Polarization }\BaseNTok{over}\NormalTok{ Redistribution and Fixed Attributes Different Cut{-}Off \textbackslash{}}\KeywordTok{label}\NormalTok{ \{Tablewithincut\}) mti(}\StringTok{"Redist"} \StringTok{"Fixed"} \StringTok{"Redist"} \StringTok{"Fixed"} \StringTok{"Redist"} \StringTok{"Fixed"} \StringTok{"Redist"} \StringTok{"Fixed"} \StringTok{"Redist"} \StringTok{"Fixed"}\NormalTok{ ) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock*     ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )  indicate(}\StringTok{"LDV = L.*"} \StringTok{"FE Year = *year"}\NormalTok{)}


\KeywordTok{restore} 
\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(202 missing values generated)
(91 real changes made)
(111 real changes made)
(202 missing values generated)
(92 real changes made)
(110 real changes made)
(202 missing values generated)
(106 real changes made)
(92 real changes made)
(202 missing values generated)
(108 real changes made)
(86 real changes made)
(202 missing values generated)
(110 real changes made)
(80 real changes made)
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)
(est5 stored)
(est6 stored)
(est7 stored)
(est8 stored)
(est9 stored)
(est10 stored)

Partisan Polarization over Redistribution and Fixed Attributes Different Cut-Of
> f \label {Tablewithincut}
-------------------------------------------------------------------------------
> -------------------------------------------------------------------
                       (1)          (2)          (3)          (4)          (5) 
>          (6)          (7)          (8)          (9)         (10)   
                    Redist        Fixed       Redist        Fixed       Redist 
>        Fixed       Redist        Fixed       Redist        Fixed   
-------------------------------------------------------------------------------
> -------------------------------------------------------------------
Post-LMP             2.919        2.708***                                     
>                                                                    
                   (2.304)      (0.866)                                        
>                                                                    
Post-LMP                                       2.919        2.708***           
>                                                                    
                                             (2.304)      (0.866)              
>                                                                    
Post-LMP                                                                 2.921 
>        2.679***                                                    
                                                                       (2.297) 
>      (0.855)                                                       
Post-LMP                                                                       
>                     2.791        2.696***                          
                                                                               
>                   (2.269)      (0.864)                             
Post-LMP                                                                       
>                                               2.642        2.671***
                                                                               
>                                             (2.240)      (0.838)   
LDV                    Yes          Yes          Yes          Yes          Yes 
>          Yes          Yes          Yes          Yes          Yes   
FE Year                Yes          Yes          Yes          Yes          Yes 
>          Yes          Yes          Yes          Yes          Yes   
-------------------------------------------------------------------------------
> -------------------------------------------------------------------
Observations           186          186          186          186          182 
>          182          178          178          174          174   
R$^2$                0.519        0.333        0.519        0.333        0.516 
>        0.344        0.531        0.352        0.542        0.360   
AIC                783.599      768.187      783.599      768.187      771.187 
>      752.039      751.737      733.099      733.090      709.586   
-------------------------------------------------------------------------------
> -------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}TabWithin\_cutoff.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Partisan Polarization }\BaseNTok{over}\NormalTok{ Redistribution and Fixed Attributes Different Cut{-}Off \textbackslash{}}\KeywordTok{label}\NormalTok{ \{Tablewithincut\}) mti(}\StringTok{"Redist"} \StringTok{"Fixed"} \StringTok{"Redist"} \StringTok{"Fixed"} \StringTok{"Redist"} \StringTok{"Fixed"} \StringTok{"Redist"} \StringTok{"Fixed"} \StringTok{"Redist"} \StringTok{"Fixed"}\NormalTok{ ) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock*     ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ )  indicate(}\StringTok{"LDV = L.*"} \StringTok{"FE Year = *year"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\TabWithin_cutoff.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A19}

% Include the table with custom numbering
\input{Table/TabWithin_cutoff.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a20-alternative-measures-of-partisan-polarization-over-fixed-attributes-between-mainstream-left-and-right-populist}{%
\paragraph{Table A20: Alternative measures of Partisan Polarization over
Fixed Attributes between Mainstream Left and
Right-Populist}\label{table-a20-alternative-measures-of-partisan-polarization-over-fixed-attributes-between-mainstream-left-and-right-populist}}

\begin{Shaded}
\begin{Highlighting}[]

\NormalTok{lab }\KeywordTok{var}\NormalTok{ distance\_fixed\_eu }\StringTok{"Anti{-}EU"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ distance\_nat }\StringTok{"Internationalism"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ distance\_fixed\_all }\StringTok{"Anti{-}Global and Cultural"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ distance\_fixed\_nolog }\StringTok{"Anti{-}Global and Cultural (no log)"}


\CommentTok{// table A20: Alternative measures of Partisan Polarization over Fixed Attributes between Mainstream Left and Right{-}Populist}
\NormalTok{\{}
\KeywordTok{preserve}

\NormalTok{eststo }\KeywordTok{clear}

\KeywordTok{foreach}\NormalTok{ x }\KeywordTok{of} \KeywordTok{varlist}\NormalTok{ distance\_fixed\_eu  distance\_nat  distance\_fixed\_all distance\_fixed\_nolog \{}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg} \OtherTok{\textasciigrave{}x\textquotesingle{}}\NormalTok{ L.}\OtherTok{\textasciigrave{}x\textquotesingle{}}\NormalTok{ shock totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg} \OtherTok{\textasciigrave{}x\textquotesingle{}}\NormalTok{ L.}\OtherTok{\textasciigrave{}x\textquotesingle{}}\NormalTok{ IFR2 totseats  oecdmember   i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}

\NormalTok{\}}
\NormalTok{esttab, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Alternative measures }\KeywordTok{of}\NormalTok{ Partisan Polarization }\BaseNTok{over}\NormalTok{ Fixed Attributes between Mainstream Left and Right{-}Populist \textbackslash{}}\KeywordTok{label}\NormalTok{ \{FVPritm\})  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock IFR2 ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate(}\StringTok{"Controls = tot*"} \StringTok{"LDV = L.*"} \StringTok{"FE Year = *year"}\NormalTok{) }


\KeywordTok{restore}

\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
  2. eststo: qui reg `x' L.`x' shock totseats  oecdmember   i.year, cluster(cou
> ntryname)
  3. eststo: qui reg `x' L.`x' IFR2 totseats  oecdmember   i.year, cluster(coun
> tryname)
  4. 
(est1 stored)
(est2 stored)
(est3 stored)
(est4 stored)
(est5 stored)
(est6 stored)
(est7 stored)
(est8 stored)

Alternative measures of Partisan Polarization over Fixed Attributes between Mai
> nstream Left and Right-Populist \label {FVPritm}
-------------------------------------------------------------------------------
> -----------------------------------------
                       (1)          (2)          (3)          (4)          (5) 
>          (6)          (7)          (8)   
                   Anti-EU      Anti-EU    Interna~m    Interna~m    Anti-Gl~l 
>    Anti-Gl~l    Anti-Gl~g    Anti-Gl~g   
-------------------------------------------------------------------------------
> -----------------------------------------
High LMP period      2.581***                  1.491***                  3.603*
> **                 21.639***             
                   (0.362)                   (0.450)                   (0.571) 
>                   (5.703)                
Robots Stock                      0.306**                   0.411**            
>        0.589***                  5.678***
                                (0.125)                   (0.167)              
>      (0.177)                   (1.714)   
Controls               Yes          Yes          Yes          Yes          Yes 
>          Yes          Yes          Yes   
LDV                    Yes          Yes          Yes          Yes          Yes 
>          Yes          Yes          Yes   
FE Year                Yes          Yes          Yes          Yes          Yes 
>          Yes          Yes          Yes   
-------------------------------------------------------------------------------
> -----------------------------------------
Observations           186           62          186           62          186 
>           62          186           62   
R$^2$                0.532        0.472        0.373        0.363        0.408 
>        0.467        0.614        0.552   
AIC                666.836      249.215      699.495      258.617      787.820 
>      278.176     1509.478      534.144   
-------------------------------------------------------------------------------
> -----------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}TabWithin\_FValternative.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Alternative measures }\KeywordTok{of}\NormalTok{ Partisan Polarization }\BaseNTok{over}\NormalTok{ Fixed Attributes between Mainstream Left and Right{-}Populist \textbackslash{}}\KeywordTok{label}\NormalTok{ \{FVPritm\})  }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock IFR2 ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate(}\StringTok{"Controls = tot*"} \StringTok{"LDV = L.*"} \StringTok{"FE Year = *year"}\NormalTok{) }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\TabWithin_FValternative.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A20}

% Include the table with custom numbering
\input{Table/TabWithin_FValternative.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a18-descriptive-statistic-pritm-1970-2019}{%
\paragraph{Table A18: Descriptive statistic: PRITM
1970-2019}\label{table-a18-descriptive-statistic-pritm-1970-2019}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Descriptive }
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\NormalTok{lab }\KeywordTok{var}\NormalTok{ distance\_fixed\_eu }\StringTok{"DFVP {-} Net Anti{-}EU"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ distance\_nat }\StringTok{"DFVP {-} Net Anti{-}Global Narrow (Internationalism)"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ distance\_fixed\_all }\StringTok{"DFVP {-} Anti{-}Global and Cultural"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ distance\_fixed\_nolog }\StringTok{"DFVP {-} Anti{-}Global and Cultural (no log)"}


\CommentTok{// table A18: Descriptive statistic: PRITM 1970{-}2019}
\NormalTok{\{}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ IFR }\StringTok{"\textbackslash{}\# Robot Stock (IFR)"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ IFR2 }\StringTok{"Ln \textbackslash{}\# Robot Stock (IFR)"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ distance\_fixed\_nolog }\StringTok{"DFVP {-} Anti{-}Global and Cultural (no log)"}
\KeywordTok{preserve}

\NormalTok{    eststo }\KeywordTok{clear}

\KeywordTok{qui}\NormalTok{ estpost }\KeywordTok{sum}\NormalTok{  totseats number2 oecdmember distance\_redist  distance\_fixed  distance\_fixed\_eu   distance\_fixed\_all distance\_nat  distance\_fixed\_all distance\_fixed\_nolog IFR IFR2, }\KeywordTok{d} 



    
    \KeywordTok{restore}
\NormalTok{    \}}
\end{Highlighting}
\end{Shaded}

\begin{Shaded}
\begin{Highlighting}[]

\NormalTok{esttab ,cells(}\StringTok{"mean(label(Mean) fmt(2)) p50(label(Median) fmt(2)) sd(label(S.D.) fmt(2)) min(label(Min.) fmt(0)) max(label(Max) fmt(0)) count(label(Obs.) fmt(0))"}\NormalTok{) }\CommentTok{///}
\NormalTok{    nonumber }\KeywordTok{label} \KeywordTok{replace} \KeywordTok{noobs}  \BaseNTok{title}\NormalTok{(Descriptive statistic: PRITM 1970{-}2019 \textbackslash{}}\KeywordTok{label}\NormalTok{ \{SummarystatPRITM\}) }

\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}desc\_PRITM.tex"}\NormalTok{,cells(}\StringTok{"mean(label(Mean) fmt(2)) p50(label(Median) fmt(2)) sd(label(S.D.) fmt(2)) min(label(Min.) fmt(0)) max(label(Max) fmt(0)) count(label(Obs.) fmt(0))"}\NormalTok{) }\CommentTok{///}
\NormalTok{    nonumber }\KeywordTok{label} \KeywordTok{replace} \KeywordTok{noobs}  \BaseNTok{title}\NormalTok{(Descriptive statistic: PRITM 1970{-}2019 \textbackslash{}}\KeywordTok{label}\NormalTok{ \{SummarystatPRITM\}) }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
Descriptive statistic: PRITM 1970-2019 \label {SummarystatPRITM}
-------------------------------------------------------------------------------
> -------------------
                                                                               
>                    
                             Mean       Median         S.D.         Min.       
>    Max         Obs.
-------------------------------------------------------------------------------
> -------------------
Total Number of Se~s       235.44       175.00       162.72           60       
>    709          202
Total Number of Pa~s         7.72         8.00         2.62            3       
>     19          202
OECD member                  9.16        10.00         2.78            0       
>     10          202
Distance Redistrib~N         4.46         4.02         2.65            0       
>     17          202
Distance Fixed-Val~(         3.07         2.84         2.12            0       
>     12          202
DFVP - Net Anti-EU           2.19         1.82         1.93            0       
>      9          202
DFVP - Anti-Global~l         3.18         2.62         2.37            0       
>     13          202
DFVP - Net Anti-Gl~I         2.63         2.50         1.83            0       
>      9          202
DFVP - Anti-Global~l         3.18         2.62         2.37            0       
>     13          202
DFVP - Anti-Global~         18.59        12.11        20.42            0       
>    110          202
\# Robot Stock (IFR)     17829.68      4399.50     41004.76            6       
> 200497           62
Ln \# Robot Stock ~)         7.90         8.39         2.34            2       
>     12           62
-------------------------------------------------------------------------------
> -------------------

(output written to Table\desc_PRITM.tex)
\end{verbatim}

\renewcommand{\thetable}{A18}

\input{Table/desc_PRITM.tex}


\renewcommand{\thetable}{\arabic{table}}

\hypertarget{cmp-appendix---average-distance-3_3_cmp_pritm_appendix_average.do}{%
\subsubsection{CMP Appendix - average distance
{[}3\_3\_CMP\_PRITM\_Appendix\_Average.do{]}}\label{cmp-appendix---average-distance-3_3_cmp_pritm_appendix_average.do}}

This do-file:

\begin{verbatim}
A. Call the Data
B. Define variables
C. Export Tables 
\end{verbatim}

Input: \textbf{Manifesto Project database}

\begin{verbatim}
- `Data\CMP\MPDataset_MPDS2020a_stata14.dta` // Data download from https://manifesto-project.wzb.eu/datasets 2021
\end{verbatim}

Final output:

\begin{itemize}
\tightlist
\item
  Cleaned data: * \texttt{Data\textbackslash{}CMP\_average.dta} this
  data contains the relevant variables for the analysis with the DV as
  the polarization over redistribution, and fixed-value positions,
  estimated as the average distance of the party system.
\item
  Tables: * table A21: Partisan Polarization over Redistribution and
  Fixed Attributes
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Alternatively }\KeywordTok{load}\NormalTok{ prepared }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}CMP\_average.dta"}\NormalTok{, }\KeywordTok{clear}   
    
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(Manifesto Project Dataset Version 2020a. Please type "notes" for more details)
\end{verbatim}

\hypertarget{table-a21-partisan-polarization-over-redistribution-and-fixed-attributes}{%
\paragraph{Table A21: Partisan Polarization over Redistribution and
Fixed
Attributes}\label{table-a21-partisan-polarization-over-redistribution-and-fixed-attributes}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Analysis}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\CommentTok{// table A21: Partisan Polarization over Redistribution and Fixed Attributes}
\NormalTok{\{}

\KeywordTok{preserve}
 
\NormalTok{eststo }\KeywordTok{clear}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ dist\_av\_welfare\_policy L.dist\_av\_welfare\_policy shock totseats  oecdmember  number2 i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ dist\_av\_fixed L.dist\_av\_fixed shock totseats  oecdmember  number2 i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}

\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Partisan Polarization }\BaseNTok{over}\NormalTok{ Redistribution and Fixed Attributes  \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TabWithinpoldistav\}) mti(}\StringTok{"Redistribution"} \StringTok{"Fixed Values"} \StringTok{"Redistribution"} \StringTok{"Fixed Values"}\NormalTok{ ) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock  ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate(}\StringTok{"Controls = tots*"} \StringTok{"LDV = L.*"} \StringTok{"FE Year = *year"}\NormalTok{) }




\KeywordTok{restore}

\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)

Partisan Polarization over Redistribution and Fixed Attributes \label {TabWithi
> npoldistav}
------------------------------------------
                       (1)          (2)   
                 Redistr~n    Fixed V~s   
------------------------------------------
High LMP period     -1.505        3.399***
                   (1.933)      (1.011)   
Controls               Yes          Yes   
LDV                    Yes          Yes   
FE Year                Yes          Yes   
------------------------------------------
Observations           186          186   
R$^2$                0.631        0.705   
AIC                899.206      889.795   
------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}Tab\_Within\_d\_av.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Partisan Polarization }\BaseNTok{over}\NormalTok{ Redistribution and Fixed Attributes  \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TabWithinpoldistav\}) mti(}\StringTok{"Redistribution"} \StringTok{"Fixed Values"} \StringTok{"Redistribution"} \StringTok{"Fixed Values"}\NormalTok{ ) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock  ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate(}\StringTok{"Controls = tots*"} \StringTok{"LDV = L.*"} \StringTok{"FE Year = *year"}\NormalTok{) }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\Tab_Within_d_av.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A21}

% Include the table with custom numbering
\input{Table/Tab_Within_d_av.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{cmp-appendix---dalton-index-3_4_cmp_pritm_appendix_dalton.do}{%
\subsubsection{CMP Appendix - Dalton index
{[}3\_4\_CMP\_PRITM\_Appendix\_Dalton.do{]}}\label{cmp-appendix---dalton-index-3_4_cmp_pritm_appendix_dalton.do}}

This do-file:

\begin{verbatim}
A. Call the Data
B. Define variables
C. Export Tables 
\end{verbatim}

Input: ** Manifesto Project database**

\begin{verbatim}
- `Data\CMP\MPDataset_MPDS2020a_stata14.dta` // Data download from https://manifesto-project.wzb.eu/datasets 2021
\end{verbatim}

Final output:

\begin{itemize}
\tightlist
\item
  Cleaned data: * \texttt{Data\textbackslash{}CMP\_Dalton.dta} this data
  contains the relevant variables for the analysis with the DV as the
  polarization over redistribution, and fixed-value positions, estimated
  as Dalton index
\item
  Tables: * table A22: Partisan Polarization over Redistribution and
  Fixed Attributes, Dalton Index
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Alternatively }\KeywordTok{load}\NormalTok{ prepared }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}CMP\_Dalton.dta"}\NormalTok{, }\KeywordTok{clear}    
    
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(Manifesto Project Dataset Version 2020a. Please type "notes" for more details)
\end{verbatim}

\hypertarget{table-a22-partisan-polarization-over-redistribution-and-fixed-attributes-dalton-index}{%
\paragraph{Table A22: Partisan Polarization over Redistribution and
Fixed Attributes, Dalton
Index}\label{table-a22-partisan-polarization-over-redistribution-and-fixed-attributes-dalton-index}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Analysis}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{\{}
\CommentTok{// table A22: Partisan Polarization over Redistribution and Fixed Attributes, Dalton Index}
\NormalTok{\{}
\KeywordTok{preserve}
\KeywordTok{keep} \KeywordTok{if}\NormalTok{ PRITM==1}
   \KeywordTok{keep} \KeywordTok{if} \FunctionTok{year}\NormalTok{\textgreater{}1969 }

\NormalTok{eststo }\KeywordTok{clear}
\CommentTok{// Redistribution}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ welfare\_policy\_dt2 L.welfare\_policy\_dt2 shock totseats  oecdmember  number2 i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ fixed\_dt2 L.fixed\_dt2 shock totseats  oecdmember  number2 i.}\FunctionTok{year}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(countryname)}



\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Polarization }\BaseNTok{over}\NormalTok{ Redistribution and Fixed Attributes, Dalton Index \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TabWithindalton\}) mti(}\StringTok{"Redistribution"} \StringTok{"Fixed Values"} \StringTok{"Redistribution"} \StringTok{"Fixed Values"}\NormalTok{ ) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate(}\StringTok{"Controls = tots*"} \StringTok{"LDV = L.*"} \StringTok{"FE Year = *year"}\NormalTok{) }




\KeywordTok{restore}
\NormalTok{\}}
\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(0 observations deleted)
(0 observations deleted)
(est1 stored)
(est2 stored)

Polarization over Redistribution and Fixed Attributes, Dalton Index \label {Tab
> Withindalton}
------------------------------------------
                       (1)          (2)   
                 Redistr~n    Fixed V~s   
------------------------------------------
High LMP period    -12.476***     9.747***
                   (2.216)      (1.003)   
Controls               Yes          Yes   
LDV                    Yes          Yes   
FE Year                Yes          Yes   
------------------------------------------
Observations           186          186   
R$^2$                0.384        0.401   
AIC               1074.384     1031.899   
------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}TabWithindalton.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Polarization }\BaseNTok{over}\NormalTok{ Redistribution and Fixed Attributes, Dalton Index \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TabWithindalton\}) mti(}\StringTok{"Redistribution"} \StringTok{"Fixed Values"} \StringTok{"Redistribution"} \StringTok{"Fixed Values"}\NormalTok{ ) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate(}\StringTok{"Controls = tots*"} \StringTok{"LDV = L.*"} \StringTok{"FE Year = *year"}\NormalTok{) }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\TabWithindalton.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A22}

% Include the table with custom numbering
\input{Table/TabWithindalton.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{cmp-appendix---er-3_5_cmp_pritm_appendix_er.do}{%
\subsubsection{CMP Appendix - ER
{[}3\_5\_CMP\_PRITM\_Appendix\_ER.do{]}}\label{cmp-appendix---er-3_5_cmp_pritm_appendix_er.do}}

This do-file:

\begin{verbatim}
A. Call the Data
B. Define variables
C. Export Tables 
\end{verbatim}

Input: ** Manifesto Project database**

\begin{verbatim}
- `Data\CMP\MPDataset_MPDS2020a_stata14.dta` // Data download from https://manifesto-project.wzb.eu/datasets 2021
\end{verbatim}

Final output:

\begin{itemize}
\item
  Cleaned data:

\begin{verbatim}
* `Data\CMP_ER.dta` this data contains the relevant variables for the analysis with the DV as the polarization over redistribution, and fixed-value positions, estimated following Esteban and Ray 1994.
\end{verbatim}
\item
  Tables:

\begin{verbatim}
* table A23: Partisan Polarization over Redistribution and Fixed Attributes
\end{verbatim}
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Alternatively }\KeywordTok{load}\NormalTok{ prepared }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}CMP\_ER.dta"}\NormalTok{, }\KeywordTok{clear}    
    
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(Manifesto Project Dataset Version 2020a. Please type "notes" for more details)
\end{verbatim}

\hypertarget{table-a23-partisan-polarization-over-redistribution-and-fixed-attributes}{%
\paragraph{Table A23: Partisan Polarization over Redistribution and
Fixed
Attributes}\label{table-a23-partisan-polarization-over-redistribution-and-fixed-attributes}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Analysis}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{\{}

\CommentTok{// table A23: Partisan Polarization over Redistribution and Fixed Attributes}
\NormalTok{\{}
\KeywordTok{preserve}

\NormalTok{eststo }\KeywordTok{clear}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_welfare\_policy3 L.distance\_welfare\_policy3 shock totseats  oecdmember  number2 , }\KeywordTok{cluster}\NormalTok{(countryname)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ distance\_fixed3 L.distance\_fixed3 shock totseats  oecdmember  number2 , }\KeywordTok{cluster}\NormalTok{(countryname)}



\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Partisan Polarization }\BaseNTok{over}\NormalTok{ Redistribution and Fixed Attributes  \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TabWithinER\}) mti(}\StringTok{"Redistribution"} \StringTok{"Fixed Values"} \StringTok{"Redistribution"} \StringTok{"Fixed Values"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock    ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate(}\StringTok{"Control variables = tot*"} \StringTok{"LDV = L.*"}\NormalTok{ )}


\KeywordTok{restore}
\NormalTok{\}}
\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)
(est2 stored)

Partisan Polarization over Redistribution and Fixed Attributes \label {TabWithi
> nER}
------------------------------------------
                       (1)          (2)   
                 Redistr~n    Fixed V~s   
------------------------------------------
High LMP period   -3.3e+03      1.1e+04***
                 (1.3e+04)    (3248.358)   
Control variab~s       Yes          Yes   
LDV                    Yes          Yes   
------------------------------------------
Observations           180          180   
R$^2$                0.326        0.295   
AIC               4589.552     4358.513   
------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}TabWithin\_ER.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(Partisan Polarization }\BaseNTok{over}\NormalTok{ Redistribution and Fixed Attributes  \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TabWithinER\}) mti(}\StringTok{"Redistribution"} \StringTok{"Fixed Values"} \StringTok{"Redistribution"} \StringTok{"Fixed Values"}\NormalTok{) }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(shock    ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) indicate(}\StringTok{"Control variables = tot*"} \StringTok{"LDV = L.*"}\NormalTok{ )}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\TabWithin_ER.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{A23}

% Include the table with custom numbering
\input{Table/TabWithin_ER.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{pritm-systems-campaign-message-and-targeting-strategies-in-germany}{%
\subsection{PRITM Systems: Campaign Message and Targeting Strategies in
Germany}\label{pritm-systems-campaign-message-and-targeting-strategies-in-germany}}

\hypertarget{topic-analysis-2_3_speech_us_germany_appendix_nmf.ipynb-1}{%
\subsubsection{Topic Analysis
{[}2\_3\_Speech\_US\_Germany\_Appendix\_NMF.ipynb{]}}\label{topic-analysis-2_3_speech_us_germany_appendix_nmf.ipynb-1}}

This file:

\begin{itemize}
\tightlist
\item
  Creates inputs for Table A17: NMF Topic Modeling.
\item
  First it does the NMF for the US, then for Germany.
\item
  Once topic are created the proportion of each one of them is
  calculated.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data/cleaned\_data.csv} \# Data for the US
\item
  \texttt{Data/cleaned\_data\_G.csv} \# Data for Germany
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  Inputs for Table A17: NMF Topic Modeling, 4 clusters, top-10 terms.
\end{itemize}

\textbf{NOTE: the code for this file can be accessed in the jupyter
notebook in the folder \texttt{do}.}

\hypertarget{targeting-strategies-electoral-performance-across-districts-3_0_regional_germany_hateincidents.rmd-3_1_regional_germany.do}{%
\subsubsection{Targeting Strategies: Electoral Performance Across
Districts {[}3\_0\_Regional\_Germany\_HateIncidents.rmd{]} \&
{[}3\_1\_Regional\_Germany.do{]}}\label{targeting-strategies-electoral-performance-across-districts-3_0_regional_germany_hateincidents.rmd-3_1_regional_germany.do}}

\hypertarget{regional_germany_hateincidents.rmd}{%
\paragraph{{[}3\_0\_Regional\_Germany\_HateIncidents.rmd{]}}\label{regional_germany_hateincidents.rmd}}

This Rmarkdown:

\begin{itemize}
\tightlist
\item
  Creates a file with the data for hate incidents by region in Germany.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  Download \texttt{arvig} data from the package
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  \texttt{Data/final\_aggregated\_data.dta} It is a dta file with the
  count of hate incidents per geographic area.
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# install.packages("devtools")}
\NormalTok{devtools}\SpecialCharTok{::}\FunctionTok{install\_github}\NormalTok{(}\StringTok{"davben/arvig"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{library}\NormalTok{(arvig)}
\FunctionTok{library}\NormalTok{(tidyverse)}
\FunctionTok{library}\NormalTok{(sf)}

\FunctionTok{data}\NormalTok{(}\StringTok{"arvig"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{Shaded}
\begin{Highlighting}[]
\DocumentationTok{\#\# Preparing the data}
\CommentTok{\#I will count the events, and create a single variable called anti, which refers to the count of incidents. }

\FunctionTok{data}\NormalTok{(arvig, }\AttributeTok{package =} \StringTok{"arvig"}\NormalTok{)}
\NormalTok{arvig}\SpecialCharTok{$}\NormalTok{count}\OtherTok{\textless{}{-}}\DecValTok{1}
\NormalTok{arvig }\OtherTok{\textless{}{-}}\NormalTok{ arvig }\SpecialCharTok{\%\textgreater{}\%}
  \FunctionTok{mutate}\NormalTok{(}\AttributeTok{attack =} \FunctionTok{case\_when}\NormalTok{(}
\NormalTok{    category\_en }\SpecialCharTok{\%in\%} \FunctionTok{c}\NormalTok{(}\StringTok{"arson \& miscellaneous attack"}\NormalTok{, }
                       \StringTok{"demonstration \& miscellaneous attack"}\NormalTok{, }
                       \StringTok{"assault"}\NormalTok{, }
                       \StringTok{"miscellaneous attack"}\NormalTok{, }
                       \StringTok{"miscellaneous attack \& assault"}\NormalTok{, }
                       \StringTok{"arson"}\NormalTok{, }
                       \StringTok{"other"}\NormalTok{) }\SpecialCharTok{\textasciitilde{}} \DecValTok{1}\NormalTok{,}
    \ConstantTok{TRUE} \SpecialCharTok{\textasciitilde{}} \DecValTok{0} \CommentTok{\# Assigns 0 if none of the conditions above are met}
\NormalTok{  ))}

\NormalTok{arvig }\OtherTok{\textless{}{-}}\NormalTok{ arvig }\SpecialCharTok{\%\textgreater{}\%}
  \FunctionTok{mutate}\NormalTok{(}\AttributeTok{demonstration =} \FunctionTok{case\_when}\NormalTok{(}
\NormalTok{    category\_en }\SpecialCharTok{\%in\%} \FunctionTok{c}\NormalTok{(}\StringTok{"demonstration"}\NormalTok{, }
                       \StringTok{"demonstration \& miscellaneous attack"}\NormalTok{, }
                       \StringTok{"suspicion"}\NormalTok{) }\SpecialCharTok{\textasciitilde{}} \DecValTok{1}\NormalTok{,}
    \ConstantTok{TRUE} \SpecialCharTok{\textasciitilde{}} \DecValTok{0} \CommentTok{\# Assigns 0 if none of the conditions above are met}
\NormalTok{  ))}
\end{Highlighting}
\end{Shaded}

Common format to merge

To merge the data with the other sources I need to modify community\_id
and call it kreis.

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{arvig}\SpecialCharTok{$}\NormalTok{kreis }\OtherTok{\textless{}{-}} \FunctionTok{ifelse}\NormalTok{(}\FunctionTok{substr}\NormalTok{(arvig}\SpecialCharTok{$}\NormalTok{community\_id, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{) }\SpecialCharTok{==} \StringTok{"0"}\NormalTok{, }
                           \FunctionTok{substr}\NormalTok{(arvig}\SpecialCharTok{$}\NormalTok{community\_id, }\DecValTok{2}\NormalTok{, }\DecValTok{5}\NormalTok{), }
                           \FunctionTok{substr}\NormalTok{(arvig}\SpecialCharTok{$}\NormalTok{community\_id, }\DecValTok{1}\NormalTok{, }\DecValTok{5}\NormalTok{))}
\end{Highlighting}
\end{Shaded}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{arvig}\SpecialCharTok{$}\NormalTok{new\_column }\OtherTok{\textless{}{-}} \FunctionTok{as.numeric}\NormalTok{(}\FunctionTok{substr}\NormalTok{(arvig}\SpecialCharTok{$}\NormalTok{community\_id, }\DecValTok{1}\NormalTok{, }\DecValTok{5}\NormalTok{))}
\CommentTok{\# Check data types for specific columns}
\FunctionTok{sapply}\NormalTok{(arvig[}\FunctionTok{c}\NormalTok{(}\StringTok{"kreis"}\NormalTok{, }\StringTok{"count"}\NormalTok{, }\StringTok{"attack"}\NormalTok{, }\StringTok{"demonstration"}\NormalTok{)], class)}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
        kreis         count        attack demonstration 
  "character"     "numeric"     "numeric"     "numeric" 
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Ensure we\textquotesingle{}re working with the correct data types}
\NormalTok{arvig}\SpecialCharTok{$}\NormalTok{kreis }\OtherTok{\textless{}{-}} \FunctionTok{as.numeric}\NormalTok{(arvig}\SpecialCharTok{$}\NormalTok{kreis)}
\NormalTok{arvig}\SpecialCharTok{$}\NormalTok{anti }\OtherTok{\textless{}{-}} \FunctionTok{as.numeric}\NormalTok{(arvig}\SpecialCharTok{$}\NormalTok{count)}

\NormalTok{arvig}\SpecialCharTok{$}\NormalTok{kreis[arvig}\SpecialCharTok{$}\NormalTok{kreis }\SpecialCharTok{==} \DecValTok{3159}\NormalTok{] }\OtherTok{\textless{}{-}} \DecValTok{3158}
\NormalTok{arvig}\SpecialCharTok{$}\NormalTok{kreis[arvig}\SpecialCharTok{$}\NormalTok{kreis }\SpecialCharTok{==} \DecValTok{11000}\NormalTok{] }\OtherTok{\textless{}{-}} \DecValTok{11100}
\NormalTok{arvig}\SpecialCharTok{$}\NormalTok{state\_state}\OtherTok{\textless{}{-}}\NormalTok{arvig}\SpecialCharTok{$}\NormalTok{state}
\end{Highlighting}
\end{Shaded}

Subsetting for the period of interest 1 year previous to the election

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Ensure that the \textquotesingle{}date\textquotesingle{} column is in Date format}
\NormalTok{arvig}\SpecialCharTok{$}\NormalTok{date }\OtherTok{\textless{}{-}} \FunctionTok{as.Date}\NormalTok{(arvig}\SpecialCharTok{$}\NormalTok{date)}


\NormalTok{subset\_arvig }\OtherTok{\textless{}{-}} \FunctionTok{subset}\NormalTok{(arvig, date }\SpecialCharTok{\textgreater{}=} \FunctionTok{as.Date}\NormalTok{(}\StringTok{"2016{-}09{-}01"}\NormalTok{) }\SpecialCharTok{\&}\NormalTok{ date }\SpecialCharTok{\textless{}=} \FunctionTok{as.Date}\NormalTok{(}\StringTok{"2017{-}10{-}01"}\NormalTok{) )}
\end{Highlighting}
\end{Shaded}

Collapsing by geographic unit

Since the data is a list of events I am aggregating it so I can have an
indicator per region.

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Aggregating numeric variables}
\NormalTok{agg\_data }\OtherTok{\textless{}{-}} \FunctionTok{aggregate}\NormalTok{(}\FunctionTok{cbind}\NormalTok{(anti, attack, demonstration) }\SpecialCharTok{\textasciitilde{}}\NormalTok{ kreis, }\AttributeTok{data =}\NormalTok{ subset\_arvig, sum, }\AttributeTok{na.rm =} \ConstantTok{TRUE}\NormalTok{)}

\NormalTok{arvig\_sorted }\OtherTok{\textless{}{-}}\NormalTok{ subset\_arvig[}\FunctionTok{order}\NormalTok{(subset\_arvig}\SpecialCharTok{$}\NormalTok{kreis), ]}
\NormalTok{first\_instances }\OtherTok{\textless{}{-}}\NormalTok{ arvig\_sorted[}\SpecialCharTok{!}\FunctionTok{duplicated}\NormalTok{(arvig\_sorted}\SpecialCharTok{$}\NormalTok{kreis), }\FunctionTok{c}\NormalTok{(}\StringTok{"kreis"}\NormalTok{, }\StringTok{"community\_id"}\NormalTok{, }\StringTok{"longitude"}\NormalTok{, }\StringTok{"latitude"}\NormalTok{, }\StringTok{"state\_state"}\NormalTok{, }\StringTok{"location"}\NormalTok{)]}

\CommentTok{\# Merging aggregated numeric data with first instances of other variables}



\NormalTok{final\_aggregated\_data }\OtherTok{\textless{}{-}} \FunctionTok{merge}\NormalTok{(agg\_data, first\_instances, }\AttributeTok{by =} \StringTok{"kreis"}\NormalTok{)}

\CommentTok{\# Replace specific \textquotesingle{}kreis\textquotesingle{} values}
\end{Highlighting}
\end{Shaded}

Saving the data I will use to merge with others sources

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{\# Get the directory of the current Rmd file}
\CommentTok{\#current\_dir \textless{}{-} dirname(rstudioapi::getActiveDocumentContext()$path)}

\CommentTok{\# Define the path to the "Publication" folder}
\CommentTok{\#publication\_folder \textless{}{-} normalizePath(file.path(current\_dir, ".."))}

\CommentTok{\# Set the working directory to the "Publication" folder}
\CommentTok{\#setwd(publication\_folder)}

\CommentTok{\# Verify the working directory has been set correctly}
\CommentTok{\#print(getwd())}

\CommentTok{\# Load the haven package}
\FunctionTok{library}\NormalTok{(haven)}

\CommentTok{\# Use write\_dta to save the dataframe as a .dta file}
\FunctionTok{write\_dta}\NormalTok{(final\_aggregated\_data, }\StringTok{"Data/Region\_Germany/final\_aggregated\_data.dta"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\hypertarget{regional_germany.do}{%
\paragraph{{[}3\_1\_Regional\_Germany.do{]}}\label{regional_germany.do}}

This do-file:

\begin{itemize}
\tightlist
\item
  Creates Table 4 and A16 using data from electoral perfomance of the
  AfD, hate incidents, and exposure to automation.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data\textbackslash{}Region\_Germany\textbackslash{}btw2017kreis\ (3).csv}
  // This file contains electoral results.
\item
  \texttt{Data\textbackslash{}Region\_Germany\textbackslash{}\ RegionEntries14.dta}
  // This file contains replication data from ``Trade and Manufacturing
  Jobs in Germany'' By Wolfgang Dauth, Sebastian Findeisen, and Jens
  Suedekum
\item
  \texttt{Data\textbackslash{}Region\_Germany\textbackslash{}final\_aggregated\_data.dta}
  // This file contains hate incidents in Germany, subset prepared from
  ARVIG data. The rmd which creates this file is named as
  \texttt{3\_0\_Regional\_Germany\_HateIncidents.rmd}
\end{itemize}

Alternatively you can go to line 79 and use prepared data: -
\texttt{Data\textbackslash{}Regional\_Germany.dta}

Output:

\begin{itemize}
\tightlist
\item
  Table 4: AfD Performance
  {[}\texttt{Table\textbackslash{}AfD\_high\_pop\_r2.tex}{]}
\item
  Table A16: Summary statistics of variables used in this study about
  AfD regional performance
  {[}\texttt{Table\textbackslash{}AfD\_descriptive.tex}{]}
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*Calling the }\KeywordTok{data}
\KeywordTok{use} \StringTok{"Data\textbackslash{}Regional\_Germany.dta"}\NormalTok{, }\KeywordTok{clear}
\end{Highlighting}
\end{Shaded}

\hypertarget{table-4-afd-performance}{%
\subparagraph{Table 4: AfD Performance}\label{table-4-afd-performance}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*******************************************************************************}
\NormalTok{* Analysis}
\NormalTok{*******************************************************************************}
\CommentTok{// Table 4: AfD Performance}


\NormalTok{eststo }\KeywordTok{clear}

\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ afp\_prop rou\_pop anti\_pop , }\KeywordTok{cluster}\NormalTok{(state\_n) }

\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ afp\_prop rou\_pop anti\_pop perc\_foreign }\OtherTok{$controls}\NormalTok{ reg\_south reg\_east reg\_north i.state\_n, }\KeywordTok{cluster}\NormalTok{(state\_n) }

\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ afp\_prop rou\_pop anti\_pop interaction\_pop     reg\_south reg\_east reg\_north perc\_foreign  }\OtherTok{$controls}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(state\_n)}
\NormalTok{eststo: }\KeywordTok{qui} \KeywordTok{reg}\NormalTok{ afp\_prop rou\_pop anti\_pop interaction\_pop     reg\_south reg\_east reg\_north  i.state\_n perc\_foreign }\OtherTok{$controls}\NormalTok{, }\KeywordTok{cluster}\NormalTok{(state\_n)}


\NormalTok{esttab , }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(AfD Performance \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableAfd\})   }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rou\_pop anti\_pop interaction* )     indicate( }\StringTok{"Other controls = perc\_foreign"} \StringTok{"FE State = *state\_n"}\NormalTok{ ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) nomtitle collabels(}\KeywordTok{none}\NormalTok{) }


    
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(est1 stored)

(est2 stored)

(est3 stored)

(est4 stored)


AfD Performance \label {TableAfd}
--------------------------------------------------------------------
                       (1)          (2)          (3)          (4)   
--------------------------------------------------------------------
Share of  expo~s    -0.220        0.294*      -0.035        0.004   
                   (0.219)      (0.142)      (0.182)      (0.186)   
Hate Incidents~p     0.654***    -0.042       -1.618***    -1.226*  
                   (0.115)      (0.090)      (0.527)      (0.655)   
Exposed x Hate                                18.772***    14.033*  
                                             (5.879)      (7.039)   
Other controls          No          Yes          Yes          Yes   
FE State                No          Yes           No          Yes   
--------------------------------------------------------------------
Observations           400          400          400          400   
R$^2$                0.144        0.699        0.603        0.704   
AIC               -1.2e+03     -1.6e+03     -1.5e+03     -1.6e+03   
--------------------------------------------------------------------
Standard errors in parentheses
* p<0.1, ** p<0.05, *** p<0.01
\end{verbatim}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}AfD\_high\_pop\_r2.tex"}\NormalTok{, }\KeywordTok{replace} \KeywordTok{label}\NormalTok{ se }\BaseNTok{title}\NormalTok{(AfD Performance \textbackslash{}}\KeywordTok{label}\NormalTok{ \{TableAfd\})   }\KeywordTok{compress}\NormalTok{ nogap }\KeywordTok{star}\NormalTok{(* 0.1 ** 0.05 *** 0.01) b(\%6.3f) }\KeywordTok{keep}\NormalTok{(rou\_pop anti\_pop interaction* )     indicate( }\StringTok{"Other controls = perc\_foreign"} \StringTok{"FE State = *state\_n"}\NormalTok{ ) scalars( }\StringTok{"N Observations"} \StringTok{"r2 R$\^{}2$"} \StringTok{"aic AIC"}\NormalTok{ ) nomtitle collabels(}\KeywordTok{none}\NormalTok{) }
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(output written to Table\AfD_high_pop_r2.tex)
\end{verbatim}

% Temporarily change table numbering
\renewcommand{\thetable}{4}

% Include the table with custom numbering
\input{Table/AfD_high_pop_r2.tex}

% Reset table numbering to default (optional)
\renewcommand{\thetable}{\arabic{table}}

\hypertarget{table-a16-summary-statistics-of-variables-used-in-this-study-about-afd-regional-performance}{%
\subparagraph{Table A16: Summary statistics of variables used in this
study about AfD regional
performance}\label{table-a16-summary-statistics-of-variables-used-in-this-study-about-afd-regional-performance}}

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{////////////////////////////////////}
\NormalTok{* Descriptives}
\CommentTok{///////////////////////////////////}


\NormalTok{eststo }\KeywordTok{clear}

\CommentTok{// table A16: Summary statistics of variables used in this study about AfD regional performance}
\NormalTok{\{}
\KeywordTok{qui}\NormalTok{ estpost }\KeywordTok{sum}\NormalTok{ afp\_prop rou\_pop anti\_pop  anti    reg\_south reg\_east reg\_north  }\OtherTok{$controls}\NormalTok{, }\KeywordTok{d}

\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{Shaded}
\begin{Highlighting}[]

\NormalTok{esttab , }\CommentTok{/// }
\NormalTok{    cells(}\StringTok{"mean(label(Mean) fmt(2)) p50(label(Median) fmt(2)) sd(label(S.D.) fmt(2)) min(label(Min.) fmt(2)) max(label(Max) fmt(2)) count(label(Obs.) fmt(0))"}\NormalTok{) }\CommentTok{///}
\NormalTok{    nonumber }\KeywordTok{label} \KeywordTok{replace} \KeywordTok{noobs}
\NormalTok{eststo }\KeywordTok{clear}

\NormalTok{esttab }\KeywordTok{using} \StringTok{"Table\textbackslash{}AfD\_descriptive.tex"}\NormalTok{, }\CommentTok{/// }
\NormalTok{    cells(}\StringTok{"mean(label(Mean) fmt(2)) p50(label(Median) fmt(2)) sd(label(S.D.) fmt(2)) min(label(Min.) fmt(2)) max(label(Max) fmt(2)) count(label(Obs.) fmt(0))"}\NormalTok{) }\CommentTok{///}
\NormalTok{    nonumber }\KeywordTok{label} \KeywordTok{replace} \KeywordTok{noobs}
\NormalTok{eststo }\KeywordTok{clear}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
                             Mean       Median         S.D.         Min.       
>    Max         Obs.
-------------------------------------------------------------------------------
> -------------------
AfD Share of votes           0.12         0.11         0.06         0.00       
>   0.37          400
Share of  exposed ~s         0.08         0.08         0.01         0.04       
>   0.15          400
Hate Incidents Per~p         0.02         0.01         0.03         0.00       
>   0.36          400
\# Hate incidents ~t         4.33         2.00         9.42         0.00       
> 156.00          400
South Region                 0.35         0.00         0.48         0.00       
>   1.00          400
East Region                  0.19         0.00         0.39         0.00       
>   1.00          400
North Region                 0.15         0.00         0.36         0.00       
>   1.00          400
Employment share o~h        14.30        12.98         5.55         5.77       
>  36.42          400
Employment share o~n         7.27         6.79         4.15         0.85       
>  21.46          400
Employment share o~)        45.81        45.81         4.35        29.34       
>  58.43          400
Employment sh.. (\%)        21.53        20.08         9.98         1.86       
>  56.96          400
Employment sh.. of~)         1.04         0.00         5.04         0.00       
>  54.34          400
-------------------------------------------------------------------------------
> -------------------


(output written to Table\AfD_descriptive.tex)
\end{verbatim}

\renewcommand{\thetable}{A16}


        \input{Table/AfD_descriptive.tex}

\renewcommand{\thetable}{\arabic{table}}

\hypertarget{appendix-figures}{%
\section{Appendix Figures}\label{appendix-figures}}

\hypertarget{figures_issp.do}{%
\subsection{{[}4\_1\_Figures\_ISSP.do{]}}\label{figures_issp.do}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Load  }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}Figures\_ISSP.dta"}\NormalTok{, }\KeywordTok{clear} 
    
\end{Highlighting}
\end{Shaded}

\hypertarget{figure-a3-importance-of-job-security-difficulties-to-find-a-new-job-concerns-about-losing-the-job-and-job-dissatisfaction}{%
\subsubsection{Figure A3: Importance of job security, Difficulties to
find a new job, Concerns about losing the job and Job
dissatisfaction}\label{figure-a3-importance-of-job-security-difficulties-to-find-a-new-job-concerns-about-losing-the-job-and-job-dissatisfaction}}

\begin{Shaded}
\begin{Highlighting}[]

\CommentTok{// Figure A3: Importance of job security, Difficulties to find a new job, Concerns about losing the job and Job dissatisfaction}
\NormalTok{\{}
\NormalTok{* The code categorizes individuals based }\KeywordTok{on}\NormalTok{ whether they find it }\KeywordTok{difficult}\NormalTok{ to }\FunctionTok{get}\NormalTok{ a }\KeywordTok{new}\NormalTok{ job, then runs a }\KeywordTok{logistic}\NormalTok{ regression to assess how the risk }\KeywordTok{of}\NormalTok{ automation influences }\KeywordTok{this}\NormalTok{ difficulty, adjusting }\KeywordTok{for}\NormalTok{ weights. It calculates the predicted probabilities }\KeywordTok{of}\NormalTok{ job difficulty across different }\KeywordTok{levels} \KeywordTok{of}\NormalTok{ automation risk and generates a }\KeywordTok{graph}\NormalTok{ to visualize these probabilities, }\KeywordTok{saving}\NormalTok{ the result }\KeywordTok{as}\NormalTok{ a file.}
\NormalTok{* Code commented }\KeywordTok{for}\NormalTok{ first }\KeywordTok{graph}\NormalTok{ whether it is }\KeywordTok{difficult}\NormalTok{ to find a }\KeywordTok{new}\NormalTok{ job. Then code }\KeywordTok{for}\NormalTok{ the other three is similar (}\KeywordTok{levels} \KeywordTok{of}\NormalTok{ variables changes so the dummies are different). }


\NormalTok{* Graph style }\KeywordTok{for}\NormalTok{ figure A3}
\NormalTok{\{}
\NormalTok{grstyle }\KeywordTok{clear}
\KeywordTok{set} \DecValTok{scheme}\NormalTok{ s2color}
\NormalTok{grstyle init}
\NormalTok{grstyle }\KeywordTok{set}\NormalTok{ plain, }\BaseNTok{nogrid}
\NormalTok{grstyle }\KeywordTok{color} \BaseNTok{background} \BaseNTok{white}
\NormalTok{\}}
\NormalTok{* W\_easynewjob}
\NormalTok{\{}
\NormalTok{* Generate a }\KeywordTok{new} \KeywordTok{variable}\NormalTok{ \textquotesingle{}W\_easynewjob\_difficult\textquotesingle{} to categorize the difficulty }\KeywordTok{of}\NormalTok{ finding a }\KeywordTok{new}\NormalTok{ job}
\NormalTok{* Set \textquotesingle{}W\_easynewjob\_difficult\textquotesingle{} to 1 }\KeywordTok{if}\NormalTok{ \textquotesingle{}W\_easynewjob\textquotesingle{} is 4 }\KeywordTok{or}\NormalTok{ 5 (indicating it is }\KeywordTok{difficult}\NormalTok{)}
\KeywordTok{gen}\NormalTok{ W\_easynewjob\_difficult = 1 }\KeywordTok{if}\NormalTok{ W\_easynewjob == 4 | W\_easynewjob == 5}
\NormalTok{* Replace \textquotesingle{}W\_easynewjob\_difficult\textquotesingle{} with 0 }\KeywordTok{if}\NormalTok{ \textquotesingle{}W\_easynewjob\textquotesingle{} is 1, 2, }\KeywordTok{or}\NormalTok{ 3 (indicating it is }\KeywordTok{not} \KeywordTok{difficult}\NormalTok{)}
\KeywordTok{replace}\NormalTok{ W\_easynewjob\_difficult = 0 }\KeywordTok{if}\NormalTok{ W\_easynewjob == 1 | W\_easynewjob == 2 | W\_easynewjob == 3}

\NormalTok{* Run a }\KeywordTok{logistic}\NormalTok{ regression }\KeywordTok{model}\NormalTok{ with \textquotesingle{}W\_easynewjob\_difficult\textquotesingle{} }\KeywordTok{as}\NormalTok{ the dependent }\KeywordTok{variable}
\KeywordTok{logit}\NormalTok{ W\_easynewjob\_difficult rti [}\KeywordTok{pweight}\NormalTok{=}\KeywordTok{weight}\NormalTok{]}

\NormalTok{* Calculate the marginal }\KeywordTok{effects} \KeywordTok{of}\NormalTok{ \textquotesingle{}rti\textquotesingle{} }\KeywordTok{on}\NormalTok{ the predicted probability }\KeywordTok{of}\NormalTok{ \textquotesingle{}W\_easynewjob\_difficult\textquotesingle{}}
\NormalTok{* atmeans calculates the marginal effect }\FunctionTok{at}\NormalTok{ the }\KeywordTok{means} \KeywordTok{of}\NormalTok{ the covariates}
\NormalTok{* }\FunctionTok{at}\NormalTok{() specifies a }\KeywordTok{range} \KeywordTok{of} \KeywordTok{values} \KeywordTok{for}\NormalTok{ \textquotesingle{}rti\textquotesingle{} from {-}1.52 to 2.24 with increments }\KeywordTok{of}\NormalTok{ 0.05}
\NormalTok{margins, atmeans }\FunctionTok{at}\NormalTok{(rti=({-}1.52(0.05)2.24))}

\NormalTok{* Plot the margins with a }\KeywordTok{line} \KeywordTok{graph}\NormalTok{ and }\KeywordTok{display}\NormalTok{ the confidence intervals }\KeywordTok{as}\NormalTok{ dotted lines}
\NormalTok{ margins, atmeans }\FunctionTok{at}\NormalTok{(rti=({-}1.52(0.05)2.24)) }
\NormalTok{     marginsplot , }\KeywordTok{recast}\NormalTok{(}\KeywordTok{line}\NormalTok{) recastci(rline) ci1opts(fintensity(50) lpattern(}\BaseNTok{dot}\NormalTok{)) xti(Risk }\KeywordTok{of}\NormalTok{ automation) yti(}\StringTok{"Predicted probability (95\% CI)"}\NormalTok{) ti(}\StringTok{"Job dissatisfaction"}\NormalTok{)  }\KeywordTok{saving}\NormalTok{(}\StringTok{"Figure/difficult.gph"}\NormalTok{, }\KeywordTok{replace}\NormalTok{)}
\NormalTok{\}}

     
\NormalTok{* W\_satisfaction}
\NormalTok{\{}
\KeywordTok{gen}\NormalTok{ dissatisfied=1 }\KeywordTok{if}\NormalTok{ W\_satisfaction==5 | W\_satisfaction==6 | W\_satisfaction==7}
\KeywordTok{replace}\NormalTok{ dissatisfied=0 }\KeywordTok{if}\NormalTok{ W\_satisfaction==1 | W\_satisfaction==2 | W\_satisfaction==3 | W\_satisfaction==4}


\KeywordTok{logit}\NormalTok{ dissatisfied rti [}\KeywordTok{pweight}\NormalTok{=}\KeywordTok{weight}\NormalTok{]}

\NormalTok{ margins, atmeans }\FunctionTok{at}\NormalTok{(rti=({-}1.52(0.05)2.24)) }
\NormalTok{     marginsplot , }\KeywordTok{recast}\NormalTok{(}\KeywordTok{line}\NormalTok{) recastci(rline) ci1opts(fintensity(50) lpattern(}\BaseNTok{dot}\NormalTok{)) xti(Risk }\KeywordTok{of}\NormalTok{ automation) yti(}\StringTok{"Predicted probability (95\% CI)"}\NormalTok{) ti(}\StringTok{"Job dissatisfaction"}\NormalTok{)  }\KeywordTok{saving}\NormalTok{(}\StringTok{"Figure/dissatisfied.gph"}\NormalTok{, }\KeywordTok{replace}\NormalTok{)}
\NormalTok{\}    }

     
\NormalTok{* W\_losing}
\NormalTok{\{}
\KeywordTok{gen}\NormalTok{ W\_losing2=1 }\KeywordTok{if}\NormalTok{ W\_losing==1 | W\_losing==2 | W\_losing==3}
\KeywordTok{replace}\NormalTok{ W\_losing2=0 }\KeywordTok{if}\NormalTok{ W\_losing==4 }


\KeywordTok{logit}\NormalTok{ W\_losing2   rti [}\KeywordTok{pweight}\NormalTok{=}\KeywordTok{weight}\NormalTok{]}

\NormalTok{ margins, atmeans }\FunctionTok{at}\NormalTok{(rti=({-}1.52(0.05)2.24)) }
\NormalTok{     marginsplot , }\KeywordTok{recast}\NormalTok{(}\KeywordTok{line}\NormalTok{) recastci(rline) ci1opts(fintensity(50) lpattern(}\BaseNTok{dot}\NormalTok{)) xti(Risk }\KeywordTok{of}\NormalTok{ automation) yti(}\StringTok{"Predicted probability (95\% CI)"}\NormalTok{) ti(}\StringTok{"Concerns about losing job"}\NormalTok{) }\KeywordTok{saving}\NormalTok{(}\StringTok{"Figure/losing.gph"}\NormalTok{, }\KeywordTok{replace}\NormalTok{)}
\NormalTok{\}}

\NormalTok{* W\_jobsec}
\NormalTok{\{}
\KeywordTok{gen}\NormalTok{ W\_jobsec2=1 }\KeywordTok{if}\NormalTok{ W\_jobsec==1 | W\_jobsec==2}
\KeywordTok{replace}\NormalTok{ W\_jobsec2=0 }\KeywordTok{if}\NormalTok{ W\_jobsec==3 | W\_jobsec==4 | W\_jobsec==5}


\KeywordTok{logit}\NormalTok{ W\_jobsec2 rti [}\KeywordTok{pweight}\NormalTok{=}\KeywordTok{weight}\NormalTok{] }
\NormalTok{ margins, atmeans }\FunctionTok{at}\NormalTok{(rti=({-}1.52(0.05)2.24)) }
\NormalTok{     marginsplot , }\KeywordTok{recast}\NormalTok{(}\KeywordTok{line}\NormalTok{) recastci(rline) ci1opts(fintensity(50) lpattern(}\BaseNTok{dot}\NormalTok{)) xti(Risk }\KeywordTok{of}\NormalTok{ automation) yti(}\StringTok{"Predicted probability (95\% CI)"}\NormalTok{) ti(}\StringTok{"Importance of job security"}\NormalTok{) }\KeywordTok{saving}\NormalTok{(}\StringTok{"Figure/security.gph"}\NormalTok{, }\KeywordTok{replace}\NormalTok{)}
\NormalTok{\}}
\NormalTok{* Combine the specified graphs into one figure}
\KeywordTok{graph} \BaseNTok{combine} \StringTok{"Figure/security.gph"} \StringTok{"Figure/difficult.gph"} \StringTok{"Figure/losing.gph"} \StringTok{"Figure/dissatisfied.gph"}

\NormalTok{* Export the combined }\KeywordTok{graph} \KeywordTok{as}\NormalTok{ a PDF file, replacing any existing file}
\KeywordTok{graph} \KeywordTok{export} \StringTok{"Figure/jobdisatisfactionpredictedtogetherall.pdf"}\NormalTok{, }\KeywordTok{as}\NormalTok{(pdf) }\KeywordTok{replace}

\NormalTok{* Delete the individual }\KeywordTok{graph}\NormalTok{ files after combining them}
\NormalTok{erase }\StringTok{"Figure/security.gph"}
\NormalTok{erase }\StringTok{"Figure/difficult.gph"}
\NormalTok{erase }\StringTok{"Figure/losing.gph"}
\NormalTok{erase }\StringTok{"Figure/dissatisfied.gph"}

\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{figure}
\centering
\includegraphics[width=12cm,height=\textheight]{Figure/jobdisatisfactionpredictedtogetherall.pdf}
\caption{Figure A3: Importance of job security, Difficulties to find a
new job, Concerns about losing the job and Job dissatisfaction}
\end{figure}

\hypertarget{figures_appendix_ess.do}{%
\subsection{{[}4\_2\_Figures\_Appendix\_ESS.do{]}}\label{figures_appendix_ess.do}}

This do-file:

\begin{itemize}
\tightlist
\item
  Creates Figure A2 using data from the ESS.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data\textbackslash{}Appendix\_ESS.dta}
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  Figure A2: Share routine and non-routine 2002-2018
  {[}\texttt{Figure\textbackslash{}Share\ routine\ and\ non\ routine.pdf}{]}
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Load  }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}Appendix\_ESS.dta"}\NormalTok{, }\KeywordTok{clear} 
    
\end{Highlighting}
\end{Shaded}

\hypertarget{figure-a2-share-routine-and-non-routine-2002-2018}{%
\subsubsection{Figure A2: Share routine and non-routine
2002-2018}\label{figure-a2-share-routine-and-non-routine-2002-2018}}

\begin{Shaded}
\begin{Highlighting}[]

\NormalTok{*******************************************************************************}
\NormalTok{* Graphs}
\NormalTok{*******************************************************************************}
\NormalTok{* Graph style}
\NormalTok{\{}
\NormalTok{grstyle }\KeywordTok{clear}
\KeywordTok{set} \DecValTok{scheme}\NormalTok{ s2color}
\NormalTok{grstyle init}
\NormalTok{grstyle }\KeywordTok{set}\NormalTok{ plain, box}
\NormalTok{grstyle }\KeywordTok{color} \BaseNTok{background} \BaseNTok{white}
\NormalTok{grstyle }\KeywordTok{color}\NormalTok{ major\_grid gs8}
\NormalTok{grstyle linepattern major\_grid }\BaseNTok{dot}
\NormalTok{\}}
\CommentTok{// Figure A2: Share routine and non{-}routine 2002{-}2018}
\NormalTok{\{}
\KeywordTok{preserve}
\CommentTok{// Preserve the current dataset in memory to allow restoration later}

\CommentTok{// Generate a binary variable \textquotesingle{}tokeep\textquotesingle{} to identify the countries to be kept for Figure A2}
\KeywordTok{gen}\NormalTok{ tokeep = (cou == }\StringTok{"BEL"}\NormalTok{ | cou == }\StringTok{"CZE"}\NormalTok{ | cou == }\StringTok{"EST"}\NormalTok{ | cou == }\StringTok{"HUN"}\NormalTok{ | cou == }\StringTok{"LUX"}\NormalTok{ | cou == }\StringTok{"SVK"}\NormalTok{ | cou == }\StringTok{"SVN"}\NormalTok{ | cou == }\StringTok{"DNK"}\NormalTok{ | cou == }\StringTok{"FIN"}\NormalTok{ | cou == }\StringTok{"FRA"}\NormalTok{ | cou == }\StringTok{"DEU"}\NormalTok{ | cou == }\StringTok{"GRC"}\NormalTok{ | cou == }\StringTok{"IRL"}\NormalTok{ | cou == }\StringTok{"NLD"}\NormalTok{ | cou == }\StringTok{"PRT"}\NormalTok{ | cou == }\StringTok{"ESP"}\NormalTok{ | cou == }\StringTok{"SWE"}\NormalTok{ | cou == }\StringTok{"GBR"}\NormalTok{ | cou == }\StringTok{"NOR"}\NormalTok{ | cou == }\StringTok{"CHE"}\NormalTok{ | cou == }\StringTok{"AUT"}\NormalTok{ | cou == }\StringTok{"ITA"}\NormalTok{ | cou == }\StringTok{"POL"}\NormalTok{)}

\CommentTok{// Keep only the observations for the countries specified in \textquotesingle{}tokeep\textquotesingle{}}
\KeywordTok{keep} \KeywordTok{if}\NormalTok{ tokeep == 1}


\CommentTok{// Keep observations where \textquotesingle{}mnactic\textquotesingle{} is 1 or 3 (paid work or unemployed looking for a job), and \textquotesingle{}rti\textquotesingle{} is not missing}
\KeywordTok{keep} \KeywordTok{if} \FunctionTok{inlist}\NormalTok{(mnactic, 1, 3) \& rti \textasciitilde{}= .}

\CommentTok{// Generate a binary variable \textquotesingle{}routine\textquotesingle{} to indicate whether the task is routine (rti \textgreater{} 0)}
\KeywordTok{gen}\NormalTok{ routine = 1 }\KeywordTok{if}\NormalTok{ rti \textgreater{} 0}
\KeywordTok{replace}\NormalTok{ routine = 0 }\KeywordTok{if}\NormalTok{ rti \textless{} 0}

\CommentTok{// Calculate the total number of people in each occupation per year for each country and routine category}
\KeywordTok{bysort} \FunctionTok{year}\NormalTok{ routine cou: }\KeywordTok{egen}\NormalTok{ empl = }\KeywordTok{sum}\NormalTok{(dweight)}

\CommentTok{// Calculate the total number of people in each ISCO2 category per year for each country}
\KeywordTok{bysort} \FunctionTok{year}\NormalTok{ cou: }\KeywordTok{egen}\NormalTok{ tot = }\KeywordTok{sum}\NormalTok{(dweight)}

\CommentTok{// Calculate the share of people within each type of task (routine or non{-}routine) per year}
\KeywordTok{gen}\NormalTok{ share = empl / tot * 100}

\CommentTok{// Label the variables with descriptive names}
\KeywordTok{label} \KeywordTok{var}\NormalTok{ empl }\StringTok{"total no people within occup/year"}
\KeywordTok{label} \KeywordTok{var}\NormalTok{ tot }\StringTok{"total no people with isco2 within year"}
\KeywordTok{label} \KeywordTok{var}\NormalTok{ share }\StringTok{"share of people within type of task routinary or not /year"}
\NormalTok{lab }\KeywordTok{var}\NormalTok{ cou }\StringTok{"Country"}

\CommentTok{// Collapse the dataset to calculate the weighted share of routine and non{-}routine tasks by year and country}
\KeywordTok{collapse}\NormalTok{ share [aw=}\KeywordTok{pweight}\NormalTok{], }\KeywordTok{by}\NormalTok{(routine }\FunctionTok{year}\NormalTok{ cou)}

\CommentTok{// Sort the dataset by country, year, and routine status}
\KeywordTok{sort}\NormalTok{ cou }\FunctionTok{year}\NormalTok{ routine share}

\CommentTok{// Generate separate variables for the share of non{-}routine and routine tasks}
\KeywordTok{gen}\NormalTok{ routine0 = share }\KeywordTok{if}\NormalTok{ routine == 0}
\KeywordTok{gen}\NormalTok{ routine1 = share }\KeywordTok{if}\NormalTok{ routine == 1}

\CommentTok{// Calculate the total share of non{-}routine tasks per year and country}
\KeywordTok{bysort} \FunctionTok{year}\NormalTok{ cou: }\KeywordTok{egen}\NormalTok{ share0 = }\KeywordTok{total}\NormalTok{(routine0)}

\CommentTok{// Calculate the total share of routine tasks per year and country}
\KeywordTok{bysort} \FunctionTok{year}\NormalTok{ cou: }\KeywordTok{egen}\NormalTok{ share1 = }\KeywordTok{total}\NormalTok{(routine1)}

\CommentTok{// Calculate the polarization between non{-}routine and routine tasks}
\KeywordTok{gen}\NormalTok{ polarization = share0 {-} share1}

\CommentTok{// Generate a line graph showing the share of routine and non{-}routine tasks over time for each country}
\KeywordTok{graph} \KeywordTok{twoway} \CommentTok{///}
    \KeywordTok{line}\NormalTok{ share }\FunctionTok{year} \KeywordTok{if}\NormalTok{ routine == 1, lc(}\KeywordTok{red}\NormalTok{) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(1 }\StringTok{"Routine"}\NormalTok{)) }\KeywordTok{by}\NormalTok{(cou) || }\CommentTok{///}
    \KeywordTok{line}\NormalTok{ share }\FunctionTok{year} \KeywordTok{if}\NormalTok{ routine == 0, lc(}\BaseNTok{blue}\NormalTok{) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{label}\NormalTok{(2 }\StringTok{"Non{-}Routine"}\NormalTok{)) }\KeywordTok{by}\NormalTok{(cou)}

\CommentTok{// Export the graph to a PDF file}
\KeywordTok{graph} \KeywordTok{export} \StringTok{"Figure\textbackslash{}Share routine and non routine.pdf"}\NormalTok{, }\KeywordTok{as}\NormalTok{(pdf) }\KeywordTok{replace}

\CommentTok{// Restore the original dataset that was in memory before any modifications}
\KeywordTok{restore}
    
\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(85,256 observations deleted)
(181,328 observations deleted)
(99,690 missing values generated)
(99,690 real changes made)
(177 missing values generated)
(177 missing values generated)
file Figure\Share routine and non routine.pdf saved as PDF format
\end{verbatim}

\begin{figure}
\centering
\includegraphics[width=12cm,height=\textheight]{Figure/Share routine and non routine.pdf}
\caption{Figure A2: Share routine and non-routine 2002-2018}
\end{figure}

\hypertarget{figures_appendix_ches.do}{%
\subsection{{[}4\_3\_Figures\_Appendix\_CHES.do{]}}\label{figures_appendix_ches.do}}

This do-file:

\begin{itemize}
\tightlist
\item
  Creates Figure A4 using data from CHES.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data\textbackslash{}1999-2019\_CHES\_dataset\_means(v3).dta}
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  Figure A4: Number of Radical Right Parties in the Party System
  {[}\texttt{Figures\textbackslash{}NewParty.pdf}{]}
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Load  }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}1999{-}2019\_CHES\_dataset\_means(v3).dta"}\NormalTok{, }\KeywordTok{clear} 
    
\end{Highlighting}
\end{Shaded}

\hypertarget{figure-a4-number-of-radical-right-parties-in-the-party-system}{%
\subsubsection{Figure A4: Number of Radical Right Parties in the Party
System}\label{figure-a4-number-of-radical-right-parties-in-the-party-system}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*******************************************************************************}
\NormalTok{* Preparing variables}
\NormalTok{*******************************************************************************}
\NormalTok{\{}
\KeywordTok{gen}\NormalTok{ radright=1 }\KeywordTok{if} \KeywordTok{family}\NormalTok{==1}
\KeywordTok{replace}\NormalTok{ radright=0 }\KeywordTok{if} \KeywordTok{family}\NormalTok{\textgreater{}1}
\NormalTok{\}}

\NormalTok{******************************************************************************}
\NormalTok{* Graph}
\NormalTok{******************************************************************************}
\NormalTok{* Graph style }
\NormalTok{\{}
\NormalTok{grstyle }\KeywordTok{clear}
\KeywordTok{set} \DecValTok{scheme}\NormalTok{ s2color}
\NormalTok{grstyle init}
\NormalTok{grstyle }\KeywordTok{set}\NormalTok{ plain, box}
\NormalTok{grstyle }\KeywordTok{color} \BaseNTok{background} \BaseNTok{white}
\NormalTok{grstyle }\KeywordTok{set} \KeywordTok{color} \BaseNTok{dknavy}
\NormalTok{grstyle yesno draw\_major\_hgrid yes}
\NormalTok{grstyle yesno draw\_major\_ygrid yes}
\NormalTok{grstyle }\KeywordTok{color}\NormalTok{ major\_grid gs8}
\NormalTok{grstyle linepattern major\_grid }\BaseNTok{dot}
\NormalTok{grstyle }\KeywordTok{color}\NormalTok{ ci\_area gs12\%50}
 \KeywordTok{graph} \KeywordTok{set} \KeywordTok{window}\NormalTok{ fontface }\StringTok{"Georgia"}
\NormalTok{\}}
\CommentTok{// Figure A4: Number of Radical Right Parties in the Party System}
\NormalTok{\{}
\KeywordTok{preserve}
\KeywordTok{collapse}\NormalTok{ (}\KeywordTok{sum}\NormalTok{) radright, }\KeywordTok{by}\NormalTok{(}\FunctionTok{year}\NormalTok{)  }\CommentTok{// Collapse the data by summing the \textquotesingle{}radright\textquotesingle{} variable for each year}

\KeywordTok{line}\NormalTok{ radright }\FunctionTok{year}\NormalTok{, }\BaseNTok{ytitle}\NormalTok{(}\StringTok{"Number of Radical Right Parties"}\NormalTok{, }\KeywordTok{size}\NormalTok{(small))   }\BaseNTok{xtitle}\NormalTok{(}\StringTok{"Year"}\NormalTok{, }\KeywordTok{size}\NormalTok{(small))  }
\KeywordTok{graph} \KeywordTok{export} \StringTok{"Figure\textbackslash{}NewParty.pdf"}\NormalTok{, }\KeywordTok{as}\NormalTok{(pdf) }\KeywordTok{replace}

\KeywordTok{restore}
\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(1,077 missing values generated)
(1,077 real changes made)


file Figure\NewParty.pdf saved as PDF format
\end{verbatim}

\begin{figure}
\centering
\includegraphics[width=12cm,height=\textheight]{Figure/NewParty.pdf}
\caption{Figure A4: Number of Radical Right Parties in the Party System}
\end{figure}

\hypertarget{figures_appendix_cmp.do}{%
\subsection{{[}4\_4\_Figures\_Appendix\_CMP.do{]}}\label{figures_appendix_cmp.do}}

This do-file:

\begin{itemize}
\tightlist
\item
  Creates Figure A5 using data from ISSP.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data\textbackslash{}CMP\textbackslash{}MPDataset\_MPDS2020a\_stata14.dta}
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  Figure A5: Number of Nationalist Parties in Elections
  {[}\texttt{Figures\textbackslash{}Nationalist.pdf}{]}
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Load  }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\KeywordTok{use} \StringTok{"Data\textbackslash{}CMP\textbackslash{}MPDataset\_MPDS2020a\_stata14.dta"}\NormalTok{, }\KeywordTok{clear} 
    
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(Manifesto Project Dataset Version 2020a. Please type "notes" for more details)
\end{verbatim}

\hypertarget{figure-a5-number-of-nationalist-parties-in-elections}{%
\subsubsection{Figure A5: Number of Nationalist Parties in
Elections}\label{figure-a5-number-of-nationalist-parties-in-elections}}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*******************************************************************************}
\NormalTok{* Preparing variables}
\NormalTok{*******************************************************************************}
\NormalTok{\{}
\KeywordTok{gen} \FunctionTok{year}\NormalTok{ = }\FunctionTok{year}\NormalTok{(edate) }

\KeywordTok{keep} \KeywordTok{if}\NormalTok{ countryname==}\StringTok{"Australia"}\NormalTok{ |  countryname==}\StringTok{"Canada"}\NormalTok{ |  countryname==}\StringTok{"Greece"}\NormalTok{ |  countryname==}\StringTok{"New Zealand"}\NormalTok{ |  countryname==}\StringTok{"Portugal"}\NormalTok{ |  countryname==}\StringTok{"Spain"}\NormalTok{ |  countryname==}\StringTok{"United Kingdom"}\NormalTok{ |  countryname==}\StringTok{"United States"}\NormalTok{ |  countryname==}\StringTok{"France"}\NormalTok{ |  countryname==}\StringTok{"Norway"}\NormalTok{ | countryname==}\StringTok{"Austria"}\NormalTok{ | countryname==}\StringTok{"Belgium"}\NormalTok{ | countryname==}\StringTok{"Denmark"}\NormalTok{ | countryname==}\StringTok{"Estonia"}\NormalTok{ | countryname==}\StringTok{"Finland"}\NormalTok{ | countryname==}\StringTok{"Hungary"}\NormalTok{ | countryname==}\StringTok{"Germany"}\NormalTok{ | countryname==}\StringTok{"Iceland"}\NormalTok{  | countryname==}\StringTok{"Ireland"}\NormalTok{  | countryname==}\StringTok{"Italy"}\NormalTok{  | countryname==}\StringTok{"Netherlands"}\NormalTok{  | countryname==}\StringTok{"Norway"}\NormalTok{ | countryname==}\StringTok{"Slovakia"}\NormalTok{ | countryname==}\StringTok{"Slovenia"}\NormalTok{ | countryname==}\StringTok{"Sweden"}\NormalTok{ | countryname==}\StringTok{"Switzerland"}

\KeywordTok{gen}\NormalTok{ radright=1 }\KeywordTok{if}\NormalTok{ parfam==70}
\KeywordTok{replace}\NormalTok{ radright=0 }\KeywordTok{if}\NormalTok{ parfam\textgreater{}70 | parfam\textless{}70}
\NormalTok{\}}

\NormalTok{*******************************************************************************}
\NormalTok{* Graphs}
\NormalTok{*******************************************************************************}
\NormalTok{* Graph style}
\NormalTok{\{}
\NormalTok{grstyle }\KeywordTok{clear}
\KeywordTok{set} \DecValTok{scheme}\NormalTok{ s2color}
\NormalTok{grstyle init}
\NormalTok{grstyle }\KeywordTok{set}\NormalTok{ plain, box}
\NormalTok{grstyle }\KeywordTok{color} \BaseNTok{background} \BaseNTok{white}
\NormalTok{grstyle }\KeywordTok{set} \KeywordTok{color} \BaseNTok{dknavy}
\NormalTok{grstyle yesno draw\_major\_hgrid yes}
\NormalTok{grstyle yesno draw\_major\_ygrid yes}
\NormalTok{grstyle }\KeywordTok{color}\NormalTok{ major\_grid gs8}
\NormalTok{grstyle linepattern major\_grid }\BaseNTok{dot}
\NormalTok{grstyle }\KeywordTok{color}\NormalTok{ ci\_area gs12\%50}
 \KeywordTok{graph} \KeywordTok{set} \KeywordTok{window}\NormalTok{ fontface }\StringTok{"Georgia"}
\NormalTok{\}}
\CommentTok{// Figure A5: Number of Nationalist Parties in Elections}
\NormalTok{\{}
\KeywordTok{sort} \FunctionTok{year}  \CommentTok{// Sort the dataset by year}
\KeywordTok{collapse}\NormalTok{ (}\KeywordTok{sum}\NormalTok{) radright, }\KeywordTok{by}\NormalTok{(}\FunctionTok{year}\NormalTok{)  }\CommentTok{// Collapse the data by summing the \textquotesingle{}radright\textquotesingle{} variable for each year}
\KeywordTok{tsset} \FunctionTok{year}  \CommentTok{// Declare the dataset to be time{-}series data with \textquotesingle{}year\textquotesingle{} as the time variable}

\KeywordTok{rolling}\NormalTok{, }\KeywordTok{window}\NormalTok{(4) }\KeywordTok{saving}\NormalTok{(rolling\_dataset, }\KeywordTok{replace}\NormalTok{): }\KeywordTok{egen}\NormalTok{ ma\_radright = }\KeywordTok{total}\NormalTok{(radright)  }\CommentTok{// Calculate a 4{-}year moving average of the \textquotesingle{}radright\textquotesingle{} variable and save the result in \textquotesingle{}rolling\_dataset.dta\textquotesingle{}}

\KeywordTok{use} \StringTok{"rolling\_dataset.dta"}\NormalTok{, }\KeywordTok{clear}  \CommentTok{// Load the \textquotesingle{}rolling\_dataset.dta\textquotesingle{} file}
\KeywordTok{line} \KeywordTok{mean} \BaseNTok{start} \KeywordTok{if} \BaseNTok{start}\NormalTok{ \textgreater{} 1969, }\BaseNTok{title}\NormalTok{(}\StringTok{"Number of Nationalist Parties with 4{-}Yr Moving Average"}\NormalTok{) }\BaseNTok{xtitle}\NormalTok{(}\StringTok{"Year"}\NormalTok{) }\BaseNTok{ytitle}\NormalTok{(}\StringTok{"Number of Nationalist Parties"}\NormalTok{)  }\CommentTok{// Create a line graph of the 4{-}year moving average of nationalist parties starting from 1970}
\KeywordTok{graph} \KeywordTok{export} \StringTok{"Figure\textbackslash{}Nationalist.pdf"}\NormalTok{, }\KeywordTok{as}\NormalTok{(pdf) }\KeywordTok{replace}  \CommentTok{// Export the graph to a PDF file and replace any existing file with the same name}

\NormalTok{* Drop the .dta file}
\NormalTok{erase }\StringTok{"rolling\_dataset.dta"}  \CommentTok{// Delete the \textquotesingle{}rolling\_dataset.dta\textquotesingle{} file from the directory}

\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(1,682 observations deleted)
(2,679 missing values generated)
(2,679 real changes made)



Time variable: year, 1920 to 2019, but with gaps
        Delta: 1 unit
(running egen on estimation sample)
(file rolling_dataset.dta not found)

Rolling replications (97)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
...............................................
file rolling_dataset.dta saved
(rolling: egen)
file Figure\Nationalist.pdf saved as PDF format
\end{verbatim}

\begin{figure}
\centering
\includegraphics[width=12cm,height=\textheight]{Figure/Nationalist.pdf}
\caption{Figure A5: Number of Nationalist Parties in Elections}
\end{figure}

\hypertarget{figures_appendix_stockrobots.do}{%
\subsection{{[}4\_5\_Figures\_Appendix\_StockRobots.do{]}}\label{figures_appendix_stockrobots.do}}

This do-file:

\begin{itemize}
\tightlist
\item
  Creates Figure A1 using data from Acemoglu \& Restrepo.
\end{itemize}

Input:

\begin{itemize}
\tightlist
\item
  \texttt{Data\textbackslash{}reproducingacemoglu.csv}
\end{itemize}

Output:

\begin{itemize}
\tightlist
\item
  Figure A1: Stock of robots per thousand of workers base 1993
  {[}\texttt{Figures\textbackslash{}number\_robots.pdf}{]}
\end{itemize}

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}
\NormalTok{* Load  }\KeywordTok{data}
\NormalTok{*\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#}

\NormalTok{ import delimited }\StringTok{"Data}\CharTok{\textbackslash{}r}\StringTok{eproducingacemoglu.csv"}\NormalTok{, }\KeywordTok{clear}
    
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
(encoding automatically selected: ISO-8859-1)
(5 vars, 22 obs)
\end{verbatim}

\hypertarget{figure-a1-stock-of-robots-per-thousand-of-workers-base-1993}{%
\subsubsection{Figure A1: Stock of robots per thousand of workers base
1993}\label{figure-a1-stock-of-robots-per-thousand-of-workers-base-1993}}

\begin{Shaded}
\begin{Highlighting}[]

\NormalTok{******************************************************************************}
\NormalTok{* Graph setting}
\NormalTok{******************************************************************************}
\NormalTok{* Graph style }
\NormalTok{\{}
\NormalTok{grstyle }\KeywordTok{clear}
\KeywordTok{set} \DecValTok{scheme}\NormalTok{ s2color}
\NormalTok{grstyle init}
\NormalTok{grstyle }\KeywordTok{set}\NormalTok{ plain, box}
\NormalTok{grstyle }\KeywordTok{color} \BaseNTok{background} \BaseNTok{white}
\NormalTok{grstyle }\KeywordTok{set} \KeywordTok{color} \BaseNTok{dknavy}
\NormalTok{grstyle yesno draw\_major\_hgrid yes}
\NormalTok{grstyle yesno draw\_major\_ygrid yes}
\NormalTok{grstyle }\KeywordTok{color}\NormalTok{ major\_grid gs8}
\NormalTok{grstyle linepattern major\_grid }\BaseNTok{dot}
\NormalTok{grstyle }\KeywordTok{color}\NormalTok{ ci\_area gs12\%50}
 \KeywordTok{graph} \KeywordTok{set} \KeywordTok{window}\NormalTok{ fontface }\StringTok{"Georgia"}
\NormalTok{\}}
 \CommentTok{//Figure A1: Stock of robots per thousand of workers base 1993}
\NormalTok{ \{}
\KeywordTok{twoway} \CommentTok{///}
\NormalTok{    (}\KeywordTok{line}\NormalTok{ germany }\FunctionTok{year}\NormalTok{, lcolor(}\BaseNTok{blue}\NormalTok{) lwidth(medium) lpattern(solid)) }\CommentTok{///}
\NormalTok{    (}\KeywordTok{line}\NormalTok{ denmarkfinlandfranceitalyandswed }\FunctionTok{year}\NormalTok{, lcolor(gs10) lwidth(medium) lpattern(longdash)) }\CommentTok{///}
\NormalTok{    (}\KeywordTok{line}\NormalTok{ unitedstates }\FunctionTok{year}\NormalTok{, lcolor(}\BaseNTok{blue}\NormalTok{) lwidth(medium) lpattern(shortdash)) }\CommentTok{///}
\NormalTok{    (}\KeywordTok{line}\NormalTok{ norwayspainanduk }\FunctionTok{year}\NormalTok{, lcolor(}\BaseNTok{blue}\NormalTok{) lwidth(medium) lpattern(dash\_dot)), }\CommentTok{///}
    \BaseNTok{xtitle}\NormalTok{(}\StringTok{"Year"}\NormalTok{) }\BaseNTok{ytitle}\NormalTok{(}\StringTok{"Stock of robots per thousand of workers"}\NormalTok{) }\CommentTok{///}
    \BaseNTok{legend}\NormalTok{(}\KeywordTok{order}\NormalTok{(1 }\StringTok{"Germany"}\NormalTok{ 2 }\StringTok{"Denmark, Finland, France, Italy and Sweden"}\NormalTok{ 3 }\StringTok{"United States"}\NormalTok{ 4 }\StringTok{"Norway, Spain, and UK"}\NormalTok{) }\BaseNTok{position}\NormalTok{(6) }\KeywordTok{size}\NormalTok{(small)) }\CommentTok{///}
    \BaseNTok{yscale}\NormalTok{(}\KeywordTok{range}\NormalTok{(0 6)) }\BaseNTok{xscale}\NormalTok{(}\KeywordTok{range}\NormalTok{(1993 2014)) }\BaseNTok{legend}\NormalTok{(}\KeywordTok{size}\NormalTok{(small))}


\KeywordTok{graph} \KeywordTok{export} \StringTok{"Figure}\CharTok{\textbackslash{}n}\StringTok{umber\_robots.pdf"}\NormalTok{, }\KeywordTok{as}\NormalTok{(pdf) }\KeywordTok{replace}
\NormalTok{\}}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
file Figure\number_robots.pdf saved as PDF format
\end{verbatim}

\begin{figure}
\centering
\includegraphics[width=12cm,height=\textheight]{Figure/number_robots.pdf}
\caption{Figure A1: Stock of robots per thousand of workers base 1993}
\end{figure}

\end{document}
